Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.9.4

Bug #8323 setNumFormat Ignored
Submitted: 2006-07-30 05:33 UTC
From: 20060106 at ausbdm dot org Assigned: progi1984
Status: Bogus Package: Spreadsheet_Excel_Writer (version 0.9.0)
PHP Version: 4.3.11 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-07-30 05:33 UTC] 20060106 at ausbdm dot org (Leith)
Description: ------------ I want to format a particular column as text, as opposed to general. I tried the following, where 9 should correspond to the text cell format, but I guess there's a problem in the module itself, as it is still formatted as general. Re. bug #3514: this appears related but distinct in that my understanding is that setNumFormat should take an integer corresponding to a particular cell format. Test script: --------------- $date_format =& $workbook->addFormat(); $date_format->setNumFormat(9); $worksheet->setColumn(3,3,12,$date_format); Expected result: ---------------- The third column should be formatted as type text (9). Actual result: -------------- The third column is formatted as type general (0).

Comments

 [2006-08-31 19:43 UTC] wizard at roborooter dot com (Francis)
the string for text "@" also doesn't work, oddly enough the number I found for text is 49, it doesn't work either. http://sc.openoffice.org/excelfileformat.pdf page 160 (section 6.45)
 [2010-03-31 17:28 UTC] progi1984 (Franck Lefevre)
-Status: Open +Status: Bogus -Assigned To: +Assigned To: progi1984
Thank you for taking the time to write to us, but this is not a bug. It's an error of use. Use this code and the column will be at the format TEXT. <?php require_once 'Spreadsheet/Excel/Writer.php'; $xls = new Spreadsheet_Excel_Writer(); $worksheet = $xls->addWorksheet("test"); $date_format =& $xls->addFormat(); $date_format->setNumFormat('@'); $worksheet->setColumn(3,3,12,$date_format); $xls->send('test'.date('His').'.xls'); $xls->close(); ?>