From 1bf40dadf93a32a15636ea7d8f2884a6cb68cb5f Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Sun, 30 Jan 2011 23:22:12 +0000 Subject: [PATCH] Bugfix: Fix Excel5 Writer so that it only writes column dimensions for columns that are actually used rather than the full range (A to IV) git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@67582 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/Writer/Excel5/Worksheet.php | 6 +++++- changelog.txt | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Classes/PHPExcel/Writer/Excel5/Worksheet.php b/Classes/PHPExcel/Writer/Excel5/Worksheet.php index c864904c..a812a642 100644 --- a/Classes/PHPExcel/Writer/Excel5/Worksheet.php +++ b/Classes/PHPExcel/Writer/Excel5/Worksheet.php @@ -256,6 +256,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $this->_firstColumnIndex = (count($col) > 0) ? PHPExcel_Cell::columnIndexFromString(substr(min($col),1)) : 1; $this->_lastColumnIndex = (count($col) > 0) ? PHPExcel_Cell::columnIndexFromString(substr(max($col),1)) : 1; + if ($this->_firstColumnIndex > 255) $this->_firstColumnIndex = 255; if ($this->_lastColumnIndex > 255) $this->_lastColumnIndex = 255; @@ -289,8 +290,9 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $this->_phpSheet->calculateColumnWidths(); // Column dimensions + $maxCol = PHPExcel_Cell::columnIndexFromString($this->_phpSheet->getHighestColumn()) -1; $columnDimensions = $this->_phpSheet->getColumnDimensions(); - for ($i = 0; $i < 256; ++$i) { + for ($i = 0; $i <= $maxCol; ++$i) { $hidden = 0; $level = 0; $xfIndex = 15; // there are 15 cell style Xfs @@ -1237,6 +1239,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter ); } + hexdump($data); + $header = pack("vv", $record, $length); $this->_append($header.$data); } diff --git a/changelog.txt b/changelog.txt index 94b0d7ad..3b28d570 100644 --- a/changelog.txt +++ b/changelog.txt @@ -52,6 +52,7 @@ Fixed in SVN: - Bugfix: (MBaker) Work item 15172 - rangeToarray function modified for non-existent cells - Bugfix: (MBaker) Work item 14980 - Images not getting copyied with the ->clone function - Bugfix: (MBaker) Work item 11576 - AdvancedValueBinder.php: String sometimes becomes a date when it shouldn't +- Bugfix: (MBaker) Fix Excel5 Writer so that it only writes column dimensions for columns that are actually used rather than the full range (A to IV) - General: (MBaker) Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer.