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

Bug #16025 MERGEDCELLS record split by CONTINUE record
Submitted: 2009-03-12 15:36 UTC
From: bjaenichen Assigned: doconnor
Status: Closed Package: Spreadsheet_Excel_Writer (version 0.9.1)
PHP Version: Irrelevant OS: openSUSE 10.2 (i586)
Roadmaps: (Not assigned)    
Subscription  


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 50 - 13 = ?

 
 [2009-03-12 15:36 UTC] bjaenichen (Bernd Jänichen)
Description: ------------ If more mergedcells ranges declared as record size limit allows in one MERGEDCELLS-record a CONTINUE-record will split MERGEDCELLS-record into pieces. This is not supported by MS-Excel, OpenOffice fileformat documentation describes how to store it correctly: "If the record size exceeds the limit, it is not continued with a CONTINUE record, but another self-contained MERGEDCELLS record is started. The limit of 8224 bytes per record results in a maximum number of 1027 merged ranges." Attached patch will fix Worksheet.php. Test script: --------------- <?PHP include "Writer.php"; $wb = new Spreadsheet_Excel_Writer("/tmp/test_merged_cells.xls"); $wb->setVersion(8); $wb->_codepage = 0x4b0; $wb->worksheetcounter = 0; $wb->localworksheets[$wb->worksheetcounter] = &$wb->addWorksheet("Table".$wb->worksheetcounter); for($i = 0; $i < 1030; $i++) { $wb->localworksheets[$wb->worksheetcounter]->writeString($i, 0, $i); $wb->localworksheets[$wb->worksheetcounter]->setMerge($i, 0, $i, 1); } $wb->close(); ?> Expected result: ---------------- MS-Excel opens the resulting XLS-testfile without any warning. Actual result: -------------- MS-Excel crashes if opening the resulting XLS-testfile.

Comments

 [2009-03-12 15:37 UTC] bjaenichen (Bernd Jänichen)
The following patch has been added/updated: Patch Name: merged_cells_patch URL: patch merged_cells_patch
 [2010-06-02 14:36 UTC] greeesha (George Levin)
Got same problem with setMerge, and had some work to isolate it and fix, instead quality search fo My solution was found in PERL Spreadsheet::WriteExcel package. There was no any "CONTINUE" blocks. So here my complete _storeMergedCells() function to Worksheet.php file. function _storeMergedCells() { // if there are no merged cell ranges set, return if (count($this->_merged_ranges) == 0) { return; } $record = 0x00E5; $length = 0x000A; foreach ($this->_merged_ranges as $range) { $header = pack('vv', $record, $length); $data = pack('vvvvv', 1, $range[0], $range[2], $range[1], $range[3]); $this->_append($header . $data); } } It works for me on Excel 2003 on about 3000 pairs of merged rows.
 [2011-12-10 08:08 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Closed -Assigned To: +Assigned To: doconnor
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net 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.