From 45f2829a3372a21aee05d20b0c15af50e38857ab Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Thu, 25 Oct 2012 12:57:48 +0100 Subject: [PATCH] Bugfix: Work item GH-66 - Wrong check for maximum number of rows in Excel5 Writer --- Classes/PHPExcel/Shared/String.php | 7 +++---- Classes/PHPExcel/Writer/Excel5/Parser.php | 11 +++++------ Classes/PHPExcel/Writer/Excel5/Workbook.php | 2 +- changelog.txt | 1 + 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Classes/PHPExcel/Shared/String.php b/Classes/PHPExcel/Shared/String.php index cee3ea4e..5f596852 100644 --- a/Classes/PHPExcel/Shared/String.php +++ b/Classes/PHPExcel/Shared/String.php @@ -493,14 +493,13 @@ class PHPExcel_Shared_String public static function ConvertEncoding($value, $to, $from) { if (self::getIsIconvEnabled()) { - $value = iconv($from, $to, $value); - return $value; + return iconv($from, $to, $value); } if (self::getIsMbstringEnabled()) { - $value = mb_convert_encoding($value, $to, $from); - return $value; + return mb_convert_encoding($value, $to, $from); } + if($from == 'UTF-16LE'){ return self::utf16_decode($value, false); }else if($from == 'UTF-16BE'){ diff --git a/Classes/PHPExcel/Writer/Excel5/Parser.php b/Classes/PHPExcel/Writer/Excel5/Parser.php index 2210db4e..baf74082 100644 --- a/Classes/PHPExcel/Writer/Excel5/Parser.php +++ b/Classes/PHPExcel/Writer/Excel5/Parser.php @@ -944,9 +944,8 @@ class PHPExcel_Writer_Excel5_Parser if ($col >= 256) { throw new Exception("Column in: $cell greater than 255"); } - // FIXME: change for BIFF8 - if ($row >= 16384) { - throw new Exception("Row in: $cell greater than 16384 "); + if ($row >= 65536) { + throw new Exception("Row in: $cell greater than 65536 "); } // Set the high bits to indicate if row or col are relative. @@ -980,11 +979,11 @@ class PHPExcel_Writer_Excel5_Parser --$row2; // Trick poor inocent Excel $col1 = 0; - $col2 = 16383; // FIXME: maximum possible value for Excel 5 (change this!!!) + $col2 = 65535; // FIXME: maximum possible value for Excel 5 (change this!!!) // FIXME: this changes for BIFF8 - if (($row1 >= 16384) or ($row2 >= 16384)) { - throw new Exception("Row in: $range greater than 16384 "); + if (($row1 >= 65536) or ($row2 >= 65536)) { + throw new Exception("Row in: $range greater than 65536 "); } // Set the high bits to indicate if rows are relative. diff --git a/Classes/PHPExcel/Writer/Excel5/Workbook.php b/Classes/PHPExcel/Writer/Excel5/Workbook.php index fb0a67c4..99d24d3f 100644 --- a/Classes/PHPExcel/Writer/Excel5/Workbook.php +++ b/Classes/PHPExcel/Writer/Excel5/Workbook.php @@ -629,7 +629,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter $rowmax = $repeat[1] - 1; } else { $rowmin = 0; - $rowmax = 16383; + $rowmax = 65535; } $this->_writeNameShort( diff --git a/changelog.txt b/changelog.txt index ffca13a4..f00fd788 100644 --- a/changelog.txt +++ b/changelog.txt @@ -26,6 +26,7 @@ Fixed in develop branch: - Bugfix: (Asker) Work item 18777 - Error in PHPEXCEL/Calculation.php script on line 2976 (stack pop check) - Bugfix: (MBaker) Work item 18794 - CSV files without a file extension being identified as HTML +- Bugfix: (MBaker) Work item GH-66 - Wrong check for maximum number of rows in Excel5 Writer --------------------------------------------------------------------------------