From 2e866457750523f1deb9d0e3f6d1386b4304e90d Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Wed, 8 Dec 2010 17:19:31 +0000 Subject: [PATCH] Prevent warnings if worksheeet dimensions are empty git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@65026 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/Writer/Excel5/Worksheet.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Classes/PHPExcel/Writer/Excel5/Worksheet.php b/Classes/PHPExcel/Writer/Excel5/Worksheet.php index 3c7dea8..d9bc718 100644 --- a/Classes/PHPExcel/Writer/Excel5/Worksheet.php +++ b/Classes/PHPExcel/Writer/Excel5/Worksheet.php @@ -249,13 +249,13 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $col[$c] = strlen($c).$c; } // Determine lowest and highest column and row - $this->_firstRowIndex = min($row); - $this->_lastRowIndex = max($row); + $this->_firstRowIndex = (count($row) > 0) ? min($row) : 1; + $this->_lastRowIndex = (count($row) > 0) ? max($row) : 1; if ($this->_firstRowIndex > 65535) $this->_firstRowIndex = 65535; if ($this->_lastRowIndex > 65535) $this->_lastRowIndex = 65535; - $this->_firstColumnIndex = PHPExcel_Cell::columnIndexFromString(substr(min($col),1)); - $this->_lastColumnIndex = PHPExcel_Cell::columnIndexFromString(substr(max($col),1)); + $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;