From 9a6a1f6a915792b212a11fbaf41f74c8b84a4ea9 Mon Sep 17 00:00:00 2001 From: Carsten Schmitz Date: Sun, 29 Nov 2009 00:25:36 +0000 Subject: [PATCH] Fixed issue #14281: Using a row > 16,384 reports an error even though the BIFF8 format should support it git-svn-id: https://svn.php.net/repository/pear/packages/Spreadsheet_Excel_Writer/trunk@291404 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../Spreadsheet/Excel/Writer/Parser.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Dtags/Spreadsheet_Excel_Writer-0.9.2/Spreadsheet/Excel/Writer/Parser.php b/Dtags/Spreadsheet_Excel_Writer-0.9.2/Spreadsheet/Excel/Writer/Parser.php index ea4319a..73d98ff 100644 --- a/Dtags/Spreadsheet_Excel_Writer-0.9.2/Spreadsheet/Excel/Writer/Parser.php +++ b/Dtags/Spreadsheet_Excel_Writer-0.9.2/Spreadsheet/Excel/Writer/Parser.php @@ -988,6 +988,7 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR /** * pack() row and column into the required 3 or 4 byte format. + * If col or row exceeds valid format bounds the maximum row/col will be used * * @access private * @param string $cell The Excel cell reference to be packed @@ -997,13 +998,18 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR { $cell = strtoupper($cell); list($row, $col, $row_rel, $col_rel) = $this->_cellToRowcol($cell); - if ($col >= 256) { - return $this->raiseError("Column in: $cell greater than 255"); + + if ($col > 255) { + $col=255; } - // FIXME: change for BIFF8 - if ($row >= 16384) { - return $this->raiseError("Row in: $cell greater than 16384 "); + if ($row > 16383 && $this->_BIFF_version == 0x0500) { + $row=16383; + } + elseif ($row > 65535 && $this->_BIFF_version == 0x0600) { + $row=65535; } + + // Set the high bits to indicate if row or col are relative. if ($this->_BIFF_version == 0x0500) {