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

Bug #8601 setNumFormat() for numbers stored as text doesn't work for numbers.
Submitted: 2006-08-31 19:45 UTC
From: wizard at roborooter dot com Assigned: progi1984
Status: Closed Package: Spreadsheet_Excel_Writer (version 0.9.2)
PHP Version: 5.2.0 RC2 OS: windows 2000/xp
Roadmaps: (Not assigned)    
Subscription  


 [2006-08-31 19:45 UTC] wizard at roborooter dot com (Francis)
Description: ------------ $textFormat->setNumFormat('@') or $textFormat->setNumFormat(49) doesn't work for formatting data as text (such as numbers that you want stored as text). I referred to open office document for the excel file format (page 160) for the @ and the 49 that should refer to formatting as text. So numbers starting with zero loose their zeros and long numbers show as scientific notation. Test script: --------------- <?php require_once "Spreadsheet/Excel/Writer.php"; $workbook =& new Spreadsheet_Excel_Writer(); $workbook->send('test.xls'); $textFormat =& $workbook->addFormat(); $textFormat->setNumFormat('@'); //or 49 $sheet1 =& $workbook->addWorksheet('Not my first sheet'); $sheet1->setColumn(0,0,20,$textFormat); $sheet1->write(0,0,"000034534"); $sheet1->write(1,0,"100000298109"); $sheet1->write(2,0,"00324838284"); $sheet1->write(3,0,"00456744675454654556"); $workbook->close(); ?> Expected result: ---------------- 000034534 100000298109 00324838284 00456744675454654556 Actual result: -------------- 34534 1E+11 324838284 4.56745E+17

Comments

 [2008-03-07 20:25 UTC] stevew (Steve Wendt)
Bugs 3514 and 8323 are perhaps related to this, but the test case here most accurately reflects the problem I want to solve. I did so by patching the write() function in Worksheet.php; the first if statement looks for a number, although it should only do so when (!$format || $format->_num_format))
 [2008-07-17 12:25 UTC] braini (Arni Kowitsch)
I try to cope with the same problem here. I can't export german postal codes and area codes for telephones. For me this has the highest priority of all bugs. By the way, is this project still active?
 [2009-11-28 23:15 UTC] cschmitz (Carsten Schmitz)
-Status: Open +Status: Verified
I can verify this problem.
 [2009-11-28 23:16 UTC] cschmitz (Carsten Schmitz)
-Package Version: 0.9.0 +Package Version: 0.9.2
 [2009-11-29 05:36 UTC] reconbot (Francis Gulotta)
This package does seem to be abandoned. I've personally moved my projects over to PHPexcel which is very active and very mature, supporting much of the newer formats. http://www.codeplex.com/PHPExcel/
 [2009-11-29 05:46 UTC] cschmitz (Carsten Schmitz)
Reconbot - we released a new version of this package today. Please don't spam the bugtracker with non-helping comments.
 [2010-03-31 17:34 UTC] progi1984 (Franck Lefevre)
-Status: Verified +Status: Closed -Assigned To: +Assigned To: progi1984
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/