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

Bug #8601 setNumFormat() for numbers stored as text doesn't work for numbers.
Submitted: 2006-08-31 14:45 UTC Modified: 2009-11-29 00:46 UTC
From: wizard at roborooter dot com Assigned:
Status: Verified Package: Spreadsheet_Excel_Writer (version 0.9.2)
PHP Version: 5.2.0 RC2 OS: windows 2000/xp
Roadmaps: (Not assigned)    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wizard at roborooter dot com
New email:
PHP Version: Package Version: OS:

 

 [2006-08-31 14: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 15: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 07: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 18:15 UTC] cschmitz (Carsten Schmitz)
-Status: Open +Status: Verified
I can verify this problem.
 [2009-11-28 18:16 UTC] cschmitz (Carsten Schmitz)
-Package Version: 0.9.0 +Package Version: 0.9.2
 [2009-11-29 00: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 00: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.