doulu8341 2014-02-18 16:40
浏览 21
已采纳

如何使用PHPExcel将0001放入excel报告中

I'm having some problems with my code in PHPexcel on generating report. I've got numbers like 0001,0002,0087 in a textbox and when I transfer it to Excel, to make a report the output is 1,2,87. Why is that?

my var to pass value to generate excel report using PHPExcel

$aic = isset($_POST['aic'.$n]) ? $_POST['aic'.$n] : "";
  • 写回答

2条回答 默认 最新

  • dongwo5110 2014-02-18 16:55
    关注

    I think setting your cell format to 4 digits number should do the trick. Try this:

    $objPHPExcel->getActiveSheet()->getStyle('A1')->getNumberFormat()->setFormatCode('0000');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?