From 0dac1e1ab5c66dca2b5adbdd2df948f0d19b861e Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Sun, 9 Sep 2012 11:38:32 +0100 Subject: [PATCH] General: (Raghav1981) ZeroHeight for rows in sheet format --- Classes/PHPExcel/Reader/Excel2007.php | 4 +++ Classes/PHPExcel/Worksheet/RowDimension.php | 27 +++++++++++++++++++ .../PHPExcel/Writer/Excel2007/Worksheet.php | 6 +++++ Classes/PHPExcel/Writer/HTML.php | 2 +- changelog.txt | 1 + 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/Classes/PHPExcel/Reader/Excel2007.php b/Classes/PHPExcel/Reader/Excel2007.php index c94d1c99..a45a6096 100644 --- a/Classes/PHPExcel/Reader/Excel2007.php +++ b/Classes/PHPExcel/Reader/Excel2007.php @@ -855,6 +855,10 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader if (isset($xmlSheet->sheetFormatPr['defaultColWidth'])) { $docSheet->getDefaultColumnDimension()->setWidth( (float)$xmlSheet->sheetFormatPr['defaultColWidth'] ); } + if (isset($xmlSheet->sheetFormatPr['zeroHeight']) && + ((string)$xmlSheet->sheetFormatPr['zeroHeight'] == '1')) { + $docSheet->getDefaultRowDimension()->setzeroHeight(true); + } } if (isset($xmlSheet->cols) && !$this->_readDataOnly) { diff --git a/Classes/PHPExcel/Worksheet/RowDimension.php b/Classes/PHPExcel/Worksheet/RowDimension.php index 0fb1f3e7..2591d4f6 100644 --- a/Classes/PHPExcel/Worksheet/RowDimension.php +++ b/Classes/PHPExcel/Worksheet/RowDimension.php @@ -51,6 +51,13 @@ class PHPExcel_Worksheet_RowDimension */ private $_rowHeight = -1; + /** + * ZeroHeight for Row? + * + * @var bool + */ + private $_zeroHeight = true; + /** * Visible? * @@ -133,6 +140,26 @@ class PHPExcel_Worksheet_RowDimension return $this; } + /** + * Get ZeroHeight + * + * @return bool + */ + public function getzeroHeight() { + return $this->_zeroHeight; + } + + /** + * Set ZeroHeight + * + * @param bool $pValue + * @return PHPExcel_Worksheet_RowDimension + */ + public function setzeroHeight($pValue = false) { + $this->_zeroHeight = $pValue; + return $this; + } + /** * Get Visible * diff --git a/Classes/PHPExcel/Writer/Excel2007/Worksheet.php b/Classes/PHPExcel/Writer/Excel2007/Worksheet.php index 038891cf..e5a7679a 100644 --- a/Classes/PHPExcel/Writer/Excel2007/Worksheet.php +++ b/Classes/PHPExcel/Writer/Excel2007/Worksheet.php @@ -319,6 +319,12 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->writeAttribute('defaultRowHeight', '14.4'); } + // Set Zero Height row + if ((string)$pSheet->getDefaultRowDimension()->getzeroHeight() == '1' || + strtolower((string)$pSheet->getDefaultRowDimension()->getzeroHeight()) == 'true' ) { + $objWriter->writeAttribute('zeroHeight', '1'); + } + // Default column width if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) { $objWriter->writeAttribute('defaultColWidth', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth())); diff --git a/Classes/PHPExcel/Writer/HTML.php b/Classes/PHPExcel/Writer/HTML.php index 68c25f98..52af1727 100644 --- a/Classes/PHPExcel/Writer/HTML.php +++ b/Classes/PHPExcel/Writer/HTML.php @@ -229,7 +229,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { */ private function _mapBorderStyle($borderStyle) { switch ($borderStyle) { - case PHPExcel_Style_Border::BORDER_NONE: return '1px hidden'; + case PHPExcel_Style_Border::BORDER_NONE: return 'none'; case PHPExcel_Style_Border::BORDER_DASHDOT: return '1px dashed'; case PHPExcel_Style_Border::BORDER_DASHDOTDOT: return '1px dotted'; case PHPExcel_Style_Border::BORDER_DASHED: return '1px dashed'; diff --git a/changelog.txt b/changelog.txt index fd7a73d6..76adc2a8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -89,6 +89,7 @@ Fixed in develop branch: - General: (MBaker) Work item 18324 - Reader factory doesn't read anymore XLTX and XLT files - General: (MBaker) Magic __toString() method added to Cell object to return raw data value as a string - General: (alexgann) Add cell indent to html rendering +- General: (Raghav1981) ZeroHeight for rows in sheet format - Bugfix: (cyberconte) Patch 12318 - OOCalc cells containing inside the tag - Bugfix: (schir1964) Fix to listWorksheetInfo() method for OOCalc Reader - Bugfix: (MBaker) Support for "e" (epoch) date format mask