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

Bug #6509 Object of class Spreadsheet_Excel_Writer_Format could not be converted to int
Submitted: 2006-01-17 20:28 UTC
From: oswaldo dot otero at gmail dot com Assigned: tuupola
Status: Closed Package: Spreadsheet_Excel_Writer
PHP Version: 5.1.1 OS: Windows 2000
Roadmaps: (Not assigned)    

 [2006-01-17 20:28 UTC] oswaldo dot otero at gmail dot com
Description: ------------ Trying to create a Excel file, i notice the follow error, when I comment some lines in Writer.php Lines(144-151) function send. The thing is that the function _XF(&$format) in Lines(1238-1247) in Worksheet.php are wrong because it's trying to change an Object into an int Test script: --------------- The fucntion was like: function _XF(&$format) { //echo __FILE__.'This is Format Index: '.$format; if ($format != 0) { return($format->getXfIndex()); } else { return(0x0F); } } But we tweak like this: function _XF(&$format) { //echo __FILE__.'This is Format Index: '.$format; if (is_object($format)) { return($format->getXfIndex()); } else { return(0x0F); } } Expected result: ---------------- Create a Excel File Actual result: -------------- Right now it's working


 [2006-02-03 19:01 UTC] erik dot buelens at telenet dot be
I have the same error when using the function: $worksheet->writeUrl(). I'm using a winXP platform. Spreadsheet_Excel_Writer-0.9.0.tgz
 [2006-02-22 05:38 UTC] feyd at devnetwork dot net (feyd)
I've run into this bug as well. Here are the lines I've altered to fix this issue: Writer/Worksheet.php:1233: if (is_object($format)) { Writer/Worksheet.php:1686: if (!is_object($format)) { Writer/Worksheet.php:1873: if (!is_object($format)) { Writer/Worksheet.php:1933: if (!is_object($format)) { Writer/Worksheet.php:2005: if (!is_object($format)) { Writer/Worksheet.php:2161: if (is_object($format)) { As with the original poster's situation, $format was being compared against zero, except for the last case where it was simply being if'd.
 [2006-03-15 10:04 UTC] rabus at users dot sourceforge dot net (Alexander M. Turek)
I can confirm that the your patch fixes the problem for me on php 5.1.2. It would be great if it could find its way into the PEAR package. :-)
 [2006-03-20 23:33 UTC] cyrille37 at free dot fr (cyrille)
Yes, of course your correction is working. Is there someone to post the correction in the source code ? Thanks cyrille
 [2006-06-15 08:39 UTC] sausis at vtex dot lt (Audrius)
I have the same error on WindowsXP PHP 5.1.4 (works with is_object()). But no errors on PHP Version 5.1.4-pl0-gentoo!
 [2006-09-08 14:53 UTC] henson dot garth at gmail dot com (Garth Henson)
I have also run into this issue. What's more, it errors out even with the sample code given in the API: require_once "Spreadsheet/Excel/Writer.php"; $workbook = new Spreadsheet_Excel_Writer(); $format =& $workbook->addFormat(array('Size' => 10, 'Align' => 'center', 'Color' => 'white', 'Pattern' => 1, 'FgColor' => 'magenta')); $worksheet =& $workbook->addWorksheet(); $worksheet->writeString(1, 0, "Magenta Hello", $format); $workbook->close(); I've tested this on PHP 4.3 as well as 5.1 with no luck. Any chance the fix above could make its way into the PEAR module would be wonderful!
 [2006-09-21 12:20 UTC] tuupola at php dot net (Mika Tuupola)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.
 [2007-02-15 07:02 UTC] bonda1_007 at yahoo dot com (James)
My problem is Column Length is fiexd 255 in Package Spreadsheet_Excel_Writer . I want To Insert More Than 255 char( string) in Column. Rest Is Working Fine. thanks James
 [2007-07-26 22:25 UTC] rickg22 (Ricardo Garcia)
For those running in PHP 5, this symptom is also caused by a PHP bug regarding zend compatibility mode. When your php.ini contains "zend.ze1_compatibility_mode = On", you get the spreadsheet error. You need to set it to Off and the excel files will be opened OK. (I say it's a PHP bug because with PHP4, the OLE class worked PERFECTLY). Somebody must find out how to treat the object, and update the PEAR package regarding object handling and passing by reference/value to avoid this error.
 [2007-07-26 22:45 UTC] rickg22 (Ricardo Garcia)
Oops - wrong bug. My coment belonged to bug #6584. Sorry.
 [2008-08-01 10:48 UTC] gampesh (Gampesh Sahu)
Hi, Thanks man addFormat is working for me but i stuck to change the sheet width can any please guide me on this. Thanks Gampesh