FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=16025&edit=1

ID: 16025
Updated by: daniel.oconnor@gmail.com
Reported By: bernd dot jaenichen at globalpark dot com
Summary: MERGEDCELLS record split by CONTINUE record
-Status: Open
+Status: Closed
Type: Bug
Package: Spreadsheet_Excel_Writer
Operating System: openSUSE 10.2 (i586)
Package Version: 0.9.1
PHP Version: Irrelevant
-Assigned To:
+Assigned To: doconnor
Roadmap Versions:
New Comment:

-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.




Previous Comments:
------------------------------------------------------------------------

[2010-06-02 10:36:17] greeesha

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.

------------------------------------------------------------------------

[2009-03-12 11:37:05] bjaenichen

The following patch has been added/updated:

Patch Name: merged_cells_patch
URL: #patch
bug:16025;patch:merged_cells_patch;revision:1236857825;

------------------------------------------------------------------------

[2009-03-12 11:36:15] bjaenichen

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.

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedDec 10, '11 at 2:08a
activeDec 10, '11 at 2:08a
posts1
users1
websitepear.php.net

1 user in discussion

Daniel Oconnor: 1 post

People

Translate

site design / logo © 2022 Grokbase