grissom Posted May 29, 2009 Share Posted May 29, 2009 Hi all I've been putting together some code for automatically writing an Excel spreadsheet in PHP A quick trawl around Google has led me to functions for opening and closing an Excel file, and writing numbers and text strings into cells. All Working Well - So Far so Good. The bit I'm missing is a PHP function to set the width of an excel column. Can anybody please help ? Many thanks and all the best. Link to comment https://forums.phpfreaks.com/topic/160158-php-excel-column-width/ Share on other sites More sharing options...
Mark Baker Posted May 29, 2009 Share Posted May 29, 2009 As somebody whose been working on an Excel reader/writer for some years, I'd be very interested if you found an answer that actually worked. The trouble is that it's very dependent on the font/size used for the cells, as explained by this article on the MS support site. The best advice I can give is to look at how we do it in PHPExcel, and read the advice given in this posting on our forum. Link to comment https://forums.phpfreaks.com/topic/160158-php-excel-column-width/#findComment-845027 Share on other sites More sharing options...
roopurt18 Posted May 30, 2009 Share Posted May 30, 2009 Are you talking about the XML-based spreadsheets (the OOXML or XMLOO or whatever MS calls it)? 1) Open Excel 2007 (or later if there is one) 2) Create a worksheet, modify some column widths, add some data 3) Save as xlsx format 4) Close Excel 5) Rename file to have zip extension 6) Unzip the file 7) Reverse engineer! Link to comment https://forums.phpfreaks.com/topic/160158-php-excel-column-width/#findComment-845390 Share on other sites More sharing options...
grissom Posted May 30, 2009 Author Share Posted May 30, 2009 Thanks Mark and Roopurt, I'm going to take a look at both of these ideas ! Link to comment https://forums.phpfreaks.com/topic/160158-php-excel-column-width/#findComment-845916 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.