Search code examples
phpexcelpearexport-to-excel

How to adjust width of cells so they do not cut words in Spreadsheet_Excel_Writer


I am trying to create an Excel sheet using the Spreadsheet_Excel_Writer that comes with Pear.
The sheet is created, and all is OK, Except, My words are being cut and the cells does not adjust their width to accommodate complete words.
I try to open it with Office 2007.
What values do I have to put into the Spreadsheet_Excel_Writer_Format object for that?


Solution

  • I don't believe you can do this with S_E_W. It would be nice if it had the equivalent of Excel's "fit auto" for column/row widths/heights, but it doesn't - you can only set a column to a specific width with $worksheet->setColumn().

    You may want to investigate switching to PHPExcel. It's still under active development and supports the newest Excel file formats, as well as a more complete API. S_E_W is essentially dead in the water and shoul be considered abandonware now.