Format The Cells For Entire Column In PHP Excel

狂风中的少年 提交于 2019-12-12 05:15:13

问题


I have used the solution found within this Answer.

The code I used looks like this:

  $objWorksheet->getColumnDimension("AM")->setWidth(20);
  $objWorksheet->SetCellValue("AM1", "Date1");
  $objWorksheet->getStyle("AM")
                 ->getNumberFormat()
                   ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);

The one problem I had is when I select the entire column as such:

It still says "general".

But when I select a range of columns from 0 to 4500 lets say:

It shows up as "text".

If set to "General" the dates are auto-formmated by Excel and read wrong into PHPExcel.

Will these cells be read as "General" or as "Text"?

Can I rely that they will always be read as "Text" using this method?

来源:https://stackoverflow.com/questions/35816644/format-the-cells-for-entire-column-in-php-excel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!