[SOLVED] About column widths...

Topics: User Forum
Jun 23, 2010 at 4:32 PM
Edited Jun 23, 2010 at 4:57 PM
From the documentation (Page 27):

If you have some Excel file and need to know the column widths in measure 3), you can read the Excel file with PHPExcel and echo the retrieved values.

But there is no example showing how....
Jul 5, 2010 at 8:50 PM
Jul 6, 2010 at 5:51 AM

Can you try with the following code?

All the best.

Jul 6, 2010 at 12:32 PM
How do I loop the columns between A and M?
Jul 6, 2010 at 7:29 PM

Thanks for the tip.

Mar 1, 2011 at 7:12 PM
Edited Mar 1, 2011 at 7:18 PM

Hi. I have tried the above code w/1.7.6 reading a client's XLSX with all columns set to width 20 in Excel, but the value returned is -1..?

I have also tried this code...


...and the value returned is 10..? When I write an XLSX with this code...


...the value Excel sees is 19.29...

It would help to either

  • ship PHPExcel with a test file that correctly reads and echoes column widths in the format PHPExcel wants from an inputted file
  • some function that auto-converts an inputted Excel width (like 20)

I am migrating from Spreadsheet_Excel_Writer which I think PHPExcel uses too but don't recall this issue with it..?

I guess adding .71 to setWidth() mostly works though.