diff --git a/Classes/PHPExcel/Writer/Excel2007.php b/Classes/PHPExcel/Writer/Excel2007.php index f18cbbcd..7823d0f3 100644 --- a/Classes/PHPExcel/Writer/Excel2007.php +++ b/Classes/PHPExcel/Writer/Excel2007.php @@ -288,7 +288,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter } // Add comment relationship parts - if (!empty($this->_spreadSheet->getSheet($i)->getComments())) { + if (count($this->_spreadSheet->getSheet($i)->getComments()) > 0) { // VML Comments $objZip->addFromString('xl/drawings/vmlDrawing' . ($i + 1) . '.vml', $this->getWriterPart('Comments')->writeVMLComments($this->_spreadSheet->getSheet($i))); @@ -297,7 +297,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter } // Add header/footer relationship parts - if (!empty($this->_spreadSheet->getSheet($i)->getHeaderFooter()->getImages())) { + if (count($this->_spreadSheet->getSheet($i)->getHeaderFooter()->getImages()) > 0) { // VML Drawings $objZip->addFromString('xl/drawings/vmlDrawingHF' . ($i + 1) . '.vml', $this->getWriterPart('Drawing')->writeVMLHeaderFooterImages($this->_spreadSheet->getSheet($i))); diff --git a/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php b/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php index 5fae5b89..8d2c0a33 100644 --- a/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php +++ b/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php @@ -129,7 +129,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W // Comments for ($i = 0; $i < $sheetCount; ++$i) { - if (!empty($pPHPExcel->getSheet($i)->getComments())) { + if (count($pPHPExcel->getSheet($i)->getComments()) > 0) { $this->_writeOverrideContentType( $objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml' ); @@ -165,7 +165,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W $sheetCount = $pPHPExcel->getSheetCount(); for ($i = 0; $i < $sheetCount; ++$i) { - if (!empty($pPHPExcel->getSheet()->getHeaderFooter()->getImages())) { + if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) { foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) { if (!isset( $aMediaContentTypes[strtolower($image->getExtension())]) ) { $aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType( $image->getPath() ); diff --git a/Classes/PHPExcel/Writer/Excel2007/Rels.php b/Classes/PHPExcel/Writer/Excel2007/Rels.php index 8c4bc20a..7a1487a5 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Rels.php +++ b/Classes/PHPExcel/Writer/Excel2007/Rels.php @@ -223,7 +223,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar // Write comments relationship? $i = 1; - if (!empty($pWorksheet->getComments())) { + if (count($pWorksheet->getComments()) > 0) { $this->_writeRelationship( $objWriter, '_comments_vml' . $i, @@ -241,7 +241,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar // Write header/footer relationship? $i = 1; - if (!empty($pWorksheet->getHeaderFooter()->getImages())) { + if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) { $this->_writeRelationship( $objWriter, '_headerfooter_vml' . $i, diff --git a/Classes/PHPExcel/Writer/Excel2007/Workbook.php b/Classes/PHPExcel/Writer/Excel2007/Workbook.php index 244d9e5c..af3fa9c3 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Workbook.php +++ b/Classes/PHPExcel/Writer/Excel2007/Workbook.php @@ -265,7 +265,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write $objWriter->startElement('definedNames'); // Named ranges - if (!empty($pPHPExcel->getNamedRanges())) { + if (count($pPHPExcel->getNamedRanges()) > 0) { // Named ranges $this->_writeNamedRanges($objWriter, $pPHPExcel); } diff --git a/Classes/PHPExcel/Writer/Excel2007/Worksheet.php b/Classes/PHPExcel/Writer/Excel2007/Worksheet.php index a548ae44..7e7d4dfc 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Worksheet.php +++ b/Classes/PHPExcel/Writer/Excel2007/Worksheet.php @@ -342,7 +342,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ private function _writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { // cols - if (!empty($pSheet->getColumnDimensions())) { + if (count($pSheet->getColumnDimensions()) > 0) { $objWriter->startElement('cols'); $pSheet->calculateColumnWidths(); @@ -624,7 +624,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ */ private function _writeProtectedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { - if (!empty($pSheet->getProtectedCells())) { + if (count($pSheet->getProtectedCells()) > 0) { // protectedRanges $objWriter->startElement('protectedRanges'); @@ -651,7 +651,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ */ private function _writeMergeCells(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { - if (!empty($pSheet->getMergeCells())) { + if (count($pSheet->getMergeCells()) > 0) { // mergeCells $objWriter->startElement('mergeCells'); @@ -1093,7 +1093,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ private function _writeLegacyDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { // If sheet contains comments, add the relationships - if (!empty($pSheet->getComments())) { + if (count($pSheet->getComments()) > 0) { $objWriter->startElement('legacyDrawing'); $objWriter->writeAttribute('r:id', 'rId_comments_vml1'); $objWriter->endElement(); @@ -1109,8 +1109,8 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ */ private function _writeLegacyDrawingHF(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { - // If sheet contains comments, add the relationships - if (!empty($pSheet->getHeaderFooter()->getImages())) { + // If sheet contains images, add the relationships + if (count($pSheet->getHeaderFooter()->getImages()) > 0) { $objWriter->startElement('legacyDrawingHF'); $objWriter->writeAttribute('r:id', 'rId_headerfooter_vml1'); $objWriter->endElement();