From 1fad8bd2ddfb09c7b034e9da5ef57f6d5df85a4f Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Thu, 9 Dec 2010 12:07:50 +0000 Subject: [PATCH] General performance improvements, and specific improvements in the CSV Reader git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@65064 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/DocumentProperties.php | 31 +- Classes/PHPExcel/Reader/CSV.php | 73 +-- Classes/PHPExcel/Reader/Excel2003XML.php | 3 +- Classes/PHPExcel/Reader/Excel2007.php | 10 +- Classes/PHPExcel/Reader/Gnumeric.php | 3 +- Classes/PHPExcel/Reader/OOCalc.php | 3 +- Classes/PHPExcel/Reader/SYLK.php | 6 +- Classes/PHPExcel/Style/Alignment.php | 330 ++++++------ Classes/PHPExcel/Style/Border.php | 147 +++--- Classes/PHPExcel/Style/Fill.php | 220 ++++---- Classes/PHPExcel/Style/Font.php | 495 +++++++++--------- Classes/PHPExcel/Style/NumberFormat.php | 28 +- Classes/PHPExcel/Worksheet.php | 12 +- .../PHPExcel/Worksheet/ColumnDimension.php | 59 +-- Classes/PHPExcel/Worksheet/HeaderFooter.php | 32 +- Classes/PHPExcel/Worksheet/PageMargins.php | 63 +-- Classes/PHPExcel/Worksheet/PageSetup.php | 25 +- Classes/PHPExcel/Worksheet/Protection.php | 52 +- Classes/PHPExcel/Worksheet/RowDimension.php | 48 +- Classes/PHPExcel/Worksheet/SheetView.php | 13 +- Classes/PHPExcel/Writer/CSV.php | 12 +- Classes/PHPExcel/Writer/Excel5.php | 18 +- Classes/PHPExcel/Writer/HTML.php | 19 +- 23 files changed, 800 insertions(+), 902 deletions(-) diff --git a/Classes/PHPExcel/DocumentProperties.php b/Classes/PHPExcel/DocumentProperties.php index 095d0bbd..42ed0ad0 100644 --- a/Classes/PHPExcel/DocumentProperties.php +++ b/Classes/PHPExcel/DocumentProperties.php @@ -49,7 +49,7 @@ class PHPExcel_DocumentProperties * * @var string */ - private $_creator; + private $_creator = 'Unknown Creator'; /** * LastModifiedBy @@ -77,42 +77,49 @@ class PHPExcel_DocumentProperties * * @var string */ - private $_title; + private $_title = 'Untitled Spreadsheet'; /** * Description * * @var string */ - private $_description; + private $_description = ''; /** * Subject * * @var string */ - private $_subject; + private $_subject = ''; /** * Keywords * * @var string */ - private $_keywords; + private $_keywords = ''; /** * Category * * @var string */ - private $_category; + private $_category = ''; + + /** + * Manager + * + * @var string + */ + private $_manager = ''; /** * Company * * @var string */ - private $_company; + private $_company = 'Microsoft Corporation'; /** * Custom Properties @@ -128,17 +135,9 @@ class PHPExcel_DocumentProperties public function __construct() { // Initialise values - $this->_creator = 'Unknown Creator'; $this->_lastModifiedBy = $this->_creator; $this->_created = time(); - $this->_modified = time(); - $this->_title = "Untitled Spreadsheet"; - $this->_subject = ''; - $this->_description = ''; - $this->_keywords = ''; - $this->_category = ''; - $this->_manager = ''; - $this->_company = 'Microsoft Corporation'; + $this->_modified = time(); } /** diff --git a/Classes/PHPExcel/Reader/CSV.php b/Classes/PHPExcel/Reader/CSV.php index 5a646f3e..5b1a90e0 100644 --- a/Classes/PHPExcel/Reader/CSV.php +++ b/Classes/PHPExcel/Reader/CSV.php @@ -50,7 +50,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader * @access private * @var string */ - private $_inputEncoding; + private $_inputEncoding = 'UTF-8'; /** * Delimiter @@ -58,7 +58,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader * @access private * @var string */ - private $_delimiter; + private $_delimiter = ','; /** * Enclosure @@ -66,7 +66,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader * @access private * @var string */ - private $_enclosure; + private $_enclosure = '"'; /** * Line ending @@ -74,7 +74,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader * @access private * @var string */ - private $_lineEnding; + private $_lineEnding = PHP_EOL; /** * Sheet index to read @@ -82,7 +82,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader * @access private * @var int */ - private $_sheetIndex; + private $_sheetIndex = 0; /** * Load rows contiguously @@ -90,7 +90,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader * @access private * @var int */ - private $_contiguous; + private $_contiguous = false; /** @@ -99,7 +99,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader * @access private * @var int */ - private $_contiguousRow; + private $_contiguousRow = -1; /** * PHPExcel_Reader_IReadFilter instance @@ -113,14 +113,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader * Create a new PHPExcel_Reader_CSV */ public function __construct() { - $this->_inputEncoding = 'UTF-8'; - $this->_delimiter = ','; - $this->_enclosure = '"'; - $this->_lineEnding = PHP_EOL; - $this->_sheetIndex = 0; $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); - $this->_contiguous = false; - $this->_contiguousRow = -1; } // function __construct() /** @@ -236,6 +229,22 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader fgets($fileHandle, 4) == "\xEF\xBB\xBF" ? fseek($fileHandle, 3) : fseek($fileHandle, 0); break; + case 'UTF-16LE': + fgets($fileHandle, 3) == "\xFF\xFE" ? + fseek($fileHandle, 2) : fseek($fileHandle, 0); + break; + case 'UTF-16BE': + fgets($fileHandle, 3) == "\xFE\xFF" ? + fseek($fileHandle, 2) : fseek($fileHandle, 0); + break; + case 'UTF-32LE': + fgets($fileHandle, 5) == "\xFF\xFE\x00\x00" ? + fseek($fileHandle, 4) : fseek($fileHandle, 0); + break; + case 'UTF-32BE': + fgets($fileHandle, 5) == "\x00\x00\xFE\xFF" ? + fseek($fileHandle, 4) : fseek($fileHandle, 0); + break; default: break; } @@ -244,42 +253,40 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader $this->_enclosure . $this->_enclosure ); - // Loop through file - $currentRow = 0; - if ($this->_contiguousRow == -1) { - $this->_contiguousRow = $objPHPExcel->getActiveSheet()->getHighestRow(); + // Set our starting row based on whether we're in contiguous mode or not + $currentRow = 1; + if ($this->_contiguous) { + $currentRow = ($this->_contiguousRow == -1) ? $objPHPExcel->getActiveSheet()->getHighestRow(): $this->_contiguousRow; } - $rowData = array(); + + // Loop through each line of the file in turn while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) { - ++$currentRow; - $rowDataCount = count($rowData); $columnLetter = 'A'; - for ($i = 0; $i < $rowDataCount; ++$i) { - if ($rowData[$i] != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) { + foreach($rowData as $rowDatum) { + if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) { // Unescape enclosures - $rowData[$i] = str_replace($escapeEnclosures, $this->_enclosure, $rowData[$i]); + $rowDatum = str_replace($escapeEnclosures, $this->_enclosure, $rowDatum); // Convert encoding if necessary if ($this->_inputEncoding !== 'UTF-8') { - $rowData[$i] = PHPExcel_Shared_String::ConvertEncoding($rowData[$i], 'UTF-8', $this->_inputEncoding); + $rowDatum = PHPExcel_Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->_inputEncoding); } - if ($this->_contiguous) { - // Set cell value - $objPHPExcel->getActiveSheet()->getCell($columnLetter . $this->_contiguousRow)->setValue($rowData[$i]); - } else { - // Set cell value - $objPHPExcel->getActiveSheet()->getCell($columnLetter . $currentRow)->setValue($rowData[$i]); - } + // Set cell value + $objPHPExcel->getActiveSheet()->getCell($columnLetter . $currentRow)->setValue($rowDatum); } ++$columnLetter; } - ++$this->_contiguousRow; + ++$currentRow; } // Close file fclose($fileHandle); + if ($this->_contiguous) { + $this->_contiguousRow = $currentRow; + } + // Return return $objPHPExcel; } // function loadIntoExisting() diff --git a/Classes/PHPExcel/Reader/Excel2003XML.php b/Classes/PHPExcel/Reader/Excel2003XML.php index c4c64dba..2cf39734 100644 --- a/Classes/PHPExcel/Reader/Excel2003XML.php +++ b/Classes/PHPExcel/Reader/Excel2003XML.php @@ -63,7 +63,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader * * @var int */ - private $_sheetIndex; + private $_sheetIndex = 0; /** * Formats @@ -158,7 +158,6 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader * Create a new PHPExcel_Reader_Excel2003XML */ public function __construct() { - $this->_sheetIndex = 0; $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); } diff --git a/Classes/PHPExcel/Reader/Excel2007.php b/Classes/PHPExcel/Reader/Excel2007.php index 7a5c2fdf..f20e5e47 100644 --- a/Classes/PHPExcel/Reader/Excel2007.php +++ b/Classes/PHPExcel/Reader/Excel2007.php @@ -431,7 +431,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader // add style to cellXf collection $objStyle = new PHPExcel_Style; - $this->_readStyle($objStyle, $style); + self::_readStyle($objStyle, $style); $excel->addCellXf($objStyle); } @@ -458,7 +458,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader // add style to cellStyleXf collection $objStyle = new PHPExcel_Style; - $this->_readStyle($objStyle, $cellStyle); + self::_readStyle($objStyle, $cellStyle); $excel->addCellStyleXf($objStyle); } } @@ -468,7 +468,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader if ($xmlStyles->dxfs) { foreach ($xmlStyles->dxfs->dxf as $dxf) { $style = new PHPExcel_Style; - $this->_readStyle($style, $dxf); + self::_readStyle($style, $dxf); $dxfs[] = $style; } } @@ -480,7 +480,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader if (isset($cellStyles[intval($cellStyle['xfId'])])) { // Set default style $style = new PHPExcel_Style; - $this->_readStyle($style, $cellStyles[intval($cellStyle['xfId'])]); + self::_readStyle($style, $cellStyles[intval($cellStyle['xfId'])]); // normal style, currently not using it for anything } @@ -1439,7 +1439,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } } - private function _readStyle($docStyle, $style) { + private static function _readStyle($docStyle, $style) { // format code if (isset($style->numFmt)) { $docStyle->getNumberFormat()->setFormatCode($style->numFmt); diff --git a/Classes/PHPExcel/Reader/Gnumeric.php b/Classes/PHPExcel/Reader/Gnumeric.php index 253acc7b..fbe30b99 100644 --- a/Classes/PHPExcel/Reader/Gnumeric.php +++ b/Classes/PHPExcel/Reader/Gnumeric.php @@ -63,7 +63,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader * * @var int */ - private $_sheetIndex; + private $_sheetIndex = 0; /** * Formats @@ -167,7 +167,6 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader * Create a new PHPExcel_Reader_Gnumeric */ public function __construct() { - $this->_sheetIndex = 0; $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance(); } diff --git a/Classes/PHPExcel/Reader/OOCalc.php b/Classes/PHPExcel/Reader/OOCalc.php index a6fb3979..17a66c6a 100644 --- a/Classes/PHPExcel/Reader/OOCalc.php +++ b/Classes/PHPExcel/Reader/OOCalc.php @@ -63,7 +63,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader * * @var int */ - private $_sheetIndex; + private $_sheetIndex = 0; /** * Formats @@ -158,7 +158,6 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader * Create a new PHPExcel_Reader_OOCalc */ public function __construct() { - $this->_sheetIndex = 0; $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); } diff --git a/Classes/PHPExcel/Reader/SYLK.php b/Classes/PHPExcel/Reader/SYLK.php index 6c5e64ef..98ec8980 100644 --- a/Classes/PHPExcel/Reader/SYLK.php +++ b/Classes/PHPExcel/Reader/SYLK.php @@ -49,14 +49,14 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader * * @var string */ - private $_inputEncoding; + private $_inputEncoding = 'ANSI'; /** * Sheet index to read * * @var int */ - private $_sheetIndex; + private $_sheetIndex = 0; /** * Formats @@ -83,8 +83,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader * Create a new PHPExcel_Reader_SYLK */ public function __construct() { - $this->_inputEncoding = 'ANSI'; - $this->_sheetIndex = 0; $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); } diff --git a/Classes/PHPExcel/Style/Alignment.php b/Classes/PHPExcel/Style/Alignment.php index 844a14ce..80fc5cf1 100644 --- a/Classes/PHPExcel/Style/Alignment.php +++ b/Classes/PHPExcel/Style/Alignment.php @@ -19,10 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version ##VERSION##, ##DATE## */ @@ -30,7 +30,7 @@ * PHPExcel_Style_Alignment * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Style_Alignment implements PHPExcel_IComparable @@ -54,42 +54,42 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable * * @var string */ - private $_horizontal; + private $_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; /** * Vertical * * @var string */ - private $_vertical; + private $_vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; /** * Text rotation * * @var int */ - private $_textRotation; + private $_textRotation = 0; /** * Wrap text * * @var boolean */ - private $_wrapText; + private $_wrapText = false; /** * Shrink to fit * * @var boolean */ - private $_shrinkToFit; + private $_shrinkToFit = false; /** * Indent - only possible with horizontal alignment left and right * * @var int */ - private $_indent; + private $_indent = 0; /** * Parent Borders @@ -112,22 +112,14 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable */ private $_parent; - /** - * Create a new PHPExcel_Style_Alignment - */ - public function __construct($isSupervisor = false) - { - // Supervisor? + /** + * Create a new PHPExcel_Style_Alignment + */ + public function __construct($isSupervisor = false) + { + // Supervisor? $this->_isSupervisor = $isSupervisor; - - // Initialise values - $this->_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; - $this->_vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; - $this->_textRotation = 0; - $this->_wrapText = false; - $this->_shrinkToFit = false; - $this->_indent = 0; - } + } /** * Bind parent. Only used for supervisor @@ -205,24 +197,24 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable return array('alignment' => $array); } - /** - * Apply styles from array - * - * - * $objPHPExcel->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray( - * array( - * 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, - * 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER, - * 'rotation' => 0, - * 'wrap' => true - * ) - * ); - * - * - * @param array $pStyles Array containing style information - * @throws Exception - * @return PHPExcel_Style_Alignment - */ + /** + * Apply styles from array + * + * + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray( + * array( + * 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, + * 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER, + * 'rotation' => 0, + * 'wrap' => true + * ) + * ); + * + * + * @param array $pStyles Array containing style information + * @throws Exception + * @return PHPExcel_Style_Alignment + */ public function applyFromArray($pStyles = null) { if (is_array($pStyles)) { if ($this->_isSupervisor) { @@ -253,28 +245,28 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable return $this; } - /** - * Get Horizontal - * - * @return string - */ - public function getHorizontal() { + /** + * Get Horizontal + * + * @return string + */ + public function getHorizontal() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getHorizontal(); } - return $this->_horizontal; - } + return $this->_horizontal; + } - /** - * Set Horizontal - * - * @param string $pValue - * @return PHPExcel_Style_Alignment - */ - public function setHorizontal($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) { - if ($pValue == '') { - $pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; - } + /** + * Set Horizontal + * + * @param string $pValue + * @return PHPExcel_Style_Alignment + */ + public function setHorizontal($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) { + if ($pValue == '') { + $pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; + } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('horizontal' => $pValue)); @@ -284,30 +276,30 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable $this->_horizontal = $pValue; } return $this; - } + } - /** - * Get Vertical - * - * @return string - */ - public function getVertical() { + /** + * Get Vertical + * + * @return string + */ + public function getVertical() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getVertical(); } - return $this->_vertical; - } + return $this->_vertical; + } - /** - * Set Vertical - * - * @param string $pValue - * @return PHPExcel_Style_Alignment - */ - public function setVertical($pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM) { - if ($pValue == '') { - $pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; - } + /** + * Set Vertical + * + * @param string $pValue + * @return PHPExcel_Style_Alignment + */ + public function setVertical($pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM) { + if ($pValue == '') { + $pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; + } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('vertical' => $pValue)); @@ -316,70 +308,70 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable $this->_vertical = $pValue; } return $this; - } + } - /** - * Get TextRotation - * - * @return int - */ - public function getTextRotation() { + /** + * Get TextRotation + * + * @return int + */ + public function getTextRotation() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getTextRotation(); } - return $this->_textRotation; - } + return $this->_textRotation; + } - /** - * Set TextRotation - * - * @param int $pValue - * @throws Exception - * @return PHPExcel_Style_Alignment - */ - public function setTextRotation($pValue = 0) { + /** + * Set TextRotation + * + * @param int $pValue + * @throws Exception + * @return PHPExcel_Style_Alignment + */ + public function setTextRotation($pValue = 0) { // Excel2007 value 255 => PHPExcel value -165 - if ($pValue == 255) { - $pValue = -165; - } + if ($pValue == 255) { + $pValue = -165; + } // Set rotation - if ( ($pValue >= -90 && $pValue <= 90) || $pValue == -165 ) { + if ( ($pValue >= -90 && $pValue <= 90) || $pValue == -165 ) { if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('rotation' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); } else { $this->_textRotation = $pValue; } - } else { - throw new Exception("Text rotation should be a value between -90 and 90."); - } + } else { + throw new Exception("Text rotation should be a value between -90 and 90."); + } - return $this; - } + return $this; + } - /** - * Get Wrap Text - * - * @return boolean - */ - public function getWrapText() { + /** + * Get Wrap Text + * + * @return boolean + */ + public function getWrapText() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getWrapText(); } - return $this->_wrapText; - } + return $this->_wrapText; + } - /** - * Set Wrap Text - * - * @param boolean $pValue - * @return PHPExcel_Style_Alignment - */ - public function setWrapText($pValue = false) { - if ($pValue == '') { - $pValue = false; - } + /** + * Set Wrap Text + * + * @param boolean $pValue + * @return PHPExcel_Style_Alignment + */ + public function setWrapText($pValue = false) { + if ($pValue == '') { + $pValue = false; + } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('wrap' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); @@ -387,30 +379,30 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable $this->_wrapText = $pValue; } return $this; - } + } - /** - * Get Shrink to fit - * - * @return boolean - */ - public function getShrinkToFit() { + /** + * Get Shrink to fit + * + * @return boolean + */ + public function getShrinkToFit() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getShrinkToFit(); } - return $this->_shrinkToFit; - } + return $this->_shrinkToFit; + } - /** - * Set Shrink to fit - * - * @param boolean $pValue - * @return PHPExcel_Style_Alignment - */ - public function setShrinkToFit($pValue = false) { - if ($pValue == '') { - $pValue = false; - } + /** + * Set Shrink to fit + * + * @param boolean $pValue + * @return PHPExcel_Style_Alignment + */ + public function setShrinkToFit($pValue = false) { + if ($pValue == '') { + $pValue = false; + } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('shrinkToFit' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); @@ -418,27 +410,27 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable $this->_shrinkToFit = $pValue; } return $this; - } + } - /** - * Get indent - * - * @return int - */ - public function getIndent() { + /** + * Get indent + * + * @return int + */ + public function getIndent() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getIndent(); } - return $this->_indent; - } + return $this->_indent; + } - /** - * Set indent - * - * @param int $pValue - * @return PHPExcel_Style_Alignment - */ - public function setIndent($pValue = 0) { + /** + * Set indent + * + * @param int $pValue + * @return PHPExcel_Style_Alignment + */ + public function setIndent($pValue = 0) { if ($pValue > 0) { if ($this->getHorizontal() != self::HORIZONTAL_GENERAL && $this->getHorizontal() != self::HORIZONTAL_LEFT && $this->getHorizontal() != self::HORIZONTAL_RIGHT) { $pValue = 0; // indent not supported @@ -451,7 +443,7 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable $this->_indent = $pValue; } return $this; - } + } /** * Get hash code @@ -462,16 +454,16 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable if ($this->_isSupervisor) { return $this->getSharedComponent()->getHashCode(); } - return md5( - $this->_horizontal - . $this->_vertical - . $this->_textRotation - . ($this->_wrapText ? 't' : 'f') - . ($this->_shrinkToFit ? 't' : 'f') + return md5( + $this->_horizontal + . $this->_vertical + . $this->_textRotation + . ($this->_wrapText ? 't' : 'f') + . ($this->_shrinkToFit ? 't' : 'f') . $this->_indent - . __CLASS__ - ); - } + . __CLASS__ + ); + } /** * Implement PHP __clone to create a deep clone, not just a shallow copy. diff --git a/Classes/PHPExcel/Style/Border.php b/Classes/PHPExcel/Style/Border.php index 87411133..7fbb43f5 100644 --- a/Classes/PHPExcel/Style/Border.php +++ b/Classes/PHPExcel/Style/Border.php @@ -19,10 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version ##VERSION##, ##DATE## */ @@ -30,7 +30,7 @@ * PHPExcel_Style_Border * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Style_Border implements PHPExcel_IComparable @@ -56,7 +56,7 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable * * @var string */ - private $_borderStyle; + private $_borderStyle = PHPExcel_Style_Border::BORDER_NONE; /** * Border color @@ -86,23 +86,22 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable */ private $_parentPropertyName; - /** - * Create a new PHPExcel_Style_Border - */ - public function __construct($isSupervisor = false) - { - // Supervisor? + /** + * Create a new PHPExcel_Style_Border + */ + public function __construct($isSupervisor = false) + { + // Supervisor? $this->_isSupervisor = $isSupervisor; - // Initialise values - $this->_borderStyle = PHPExcel_Style_Border::BORDER_NONE; + // Initialise values $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); // bind parent if we are a supervisor if ($isSupervisor) { $this->_color->bindParent($this, '_color'); } - } + } /** * Bind parent. Only used for supervisor @@ -253,24 +252,24 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable return $this->_parent->getStyleArray(array($key => $array)); } - /** - * Apply styles from array - * - * - * $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray( - * array( - * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, - * 'color' => array( - * 'rgb' => '808080' - * ) - * ) - * ); - * - * - * @param array $pStyles Array containing style information - * @throws Exception - * @return PHPExcel_Style_Border - */ + /** + * Apply styles from array + * + * + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray( + * array( + * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, + * 'color' => array( + * 'rgb' => '808080' + * ) + * ) + * ); + * + * + * @param array $pStyles Array containing style information + * @throws Exception + * @return PHPExcel_Style_Border + */ public function applyFromArray($pStyles = null) { if (is_array($pStyles)) { if ($this->_isSupervisor) { @@ -289,29 +288,29 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable return $this; } - /** - * Get Border style - * - * @return string - */ - public function getBorderStyle() { + /** + * Get Border style + * + * @return string + */ + public function getBorderStyle() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getBorderStyle(); } - return $this->_borderStyle; - } + return $this->_borderStyle; + } - /** - * Set Border style - * - * @param string $pValue - * @return PHPExcel_Style_Border - */ - public function setBorderStyle($pValue = PHPExcel_Style_Border::BORDER_NONE) { + /** + * Set Border style + * + * @param string $pValue + * @return PHPExcel_Style_Border + */ + public function setBorderStyle($pValue = PHPExcel_Style_Border::BORDER_NONE) { - if ($pValue == '') { - $pValue = PHPExcel_Style_Border::BORDER_NONE; - } + if ($pValue == '') { + $pValue = PHPExcel_Style_Border::BORDER_NONE; + } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('style' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); @@ -319,25 +318,25 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable $this->_borderStyle = $pValue; } return $this; - } + } - /** - * Get Border Color - * - * @return PHPExcel_Style_Color - */ - public function getColor() { - return $this->_color; - } + /** + * Get Border Color + * + * @return PHPExcel_Style_Color + */ + public function getColor() { + return $this->_color; + } - /** - * Set Border Color - * - * @param PHPExcel_Style_Color $pValue - * @throws Exception - * @return PHPExcel_Style_Border - */ - public function setColor(PHPExcel_Style_Color $pValue = null) { + /** + * Set Border Color + * + * @param PHPExcel_Style_Color $pValue + * @throws Exception + * @return PHPExcel_Style_Border + */ + public function setColor(PHPExcel_Style_Color $pValue = null) { // make sure parameter is a real color and not a supervisor $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; @@ -348,7 +347,7 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable $this->_color = $color; } return $this; - } + } /** * Get hash code @@ -359,12 +358,12 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable if ($this->_isSupervisor) { return $this->getSharedComponent()->getHashCode(); } - return md5( - $this->_borderStyle - . $this->_color->getHashCode() - . __CLASS__ - ); - } + return md5( + $this->_borderStyle + . $this->_color->getHashCode() + . __CLASS__ + ); + } /** * Implement PHP __clone to create a deep clone, not just a shallow copy. diff --git a/Classes/PHPExcel/Style/Fill.php b/Classes/PHPExcel/Style/Fill.php index 249d9f0c..5fe88f48 100644 --- a/Classes/PHPExcel/Style/Fill.php +++ b/Classes/PHPExcel/Style/Fill.php @@ -19,10 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version ##VERSION##, ##DATE## */ @@ -30,7 +30,7 @@ * PHPExcel_Style_Fill * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Style_Fill implements PHPExcel_IComparable @@ -63,14 +63,14 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable * * @var string */ - private $_fillType; + private $_fillType = PHPExcel_Style_Fill::FILL_NONE; /** * Rotation * * @var double */ - private $_rotation; + private $_rotation = 0; /** * Start color @@ -107,17 +107,15 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable */ private $_parent; - /** - * Create a new PHPExcel_Style_Fill - */ - public function __construct($isSupervisor = false) - { - // Supervisor? + /** + * Create a new PHPExcel_Style_Fill + */ + public function __construct($isSupervisor = false) + { + // Supervisor? $this->_isSupervisor = $isSupervisor; - // Initialise values - $this->_fillType = PHPExcel_Style_Fill::FILL_NONE; - $this->_rotation = 0; + // Initialise values $this->_startColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_WHITE, $isSupervisor); $this->_endColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); @@ -126,7 +124,7 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable $this->_startColor->bindParent($this, '_startColor'); $this->_endColor->bindParent($this, '_endColor'); } - } + } /** * Bind parent. Only used for supervisor @@ -204,28 +202,28 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable return array('fill' => $array); } - /** - * Apply styles from array - * - * - * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray( - * array( - * 'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, - * 'rotation' => 0, - * 'startcolor' => array( - * 'rgb' => '000000' - * ), - * 'endcolor' => array( - * 'argb' => 'FFFFFFFF' - * ) - * ) - * ); - * - * - * @param array $pStyles Array containing style information - * @throws Exception - * @return PHPExcel_Style_Fill - */ + /** + * Apply styles from array + * + * + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray( + * array( + * 'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, + * 'rotation' => 0, + * 'startcolor' => array( + * 'rgb' => '000000' + * ), + * 'endcolor' => array( + * 'argb' => 'FFFFFFFF' + * ) + * ) + * ); + * + * + * @param array $pStyles Array containing style information + * @throws Exception + * @return PHPExcel_Style_Fill + */ public function applyFromArray($pStyles = null) { if (is_array($pStyles)) { if ($this->_isSupervisor) { @@ -253,25 +251,25 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable return $this; } - /** - * Get Fill Type - * - * @return string - */ - public function getFillType() { + /** + * Get Fill Type + * + * @return string + */ + public function getFillType() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getFillType(); } return $this->_fillType; - } + } - /** - * Set Fill Type - * - * @param string $pValue PHPExcel_Style_Fill fill type - * @return PHPExcel_Style_Fill - */ - public function setFillType($pValue = PHPExcel_Style_Fill::FILL_NONE) { + /** + * Set Fill Type + * + * @param string $pValue PHPExcel_Style_Fill fill type + * @return PHPExcel_Style_Fill + */ + public function setFillType($pValue = PHPExcel_Style_Fill::FILL_NONE) { if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('type' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); @@ -279,27 +277,27 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable $this->_fillType = $pValue; } return $this; - } + } - /** - * Get Rotation - * - * @return double - */ - public function getRotation() { + /** + * Get Rotation + * + * @return double + */ + public function getRotation() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getRotation(); } - return $this->_rotation; - } + return $this->_rotation; + } - /** - * Set Rotation - * - * @param double $pValue - * @return PHPExcel_Style_Fill - */ - public function setRotation($pValue = 0) { + /** + * Set Rotation + * + * @param double $pValue + * @return PHPExcel_Style_Fill + */ + public function setRotation($pValue = 0) { if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('rotation' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); @@ -307,25 +305,25 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable $this->_rotation = $pValue; } return $this; - } + } - /** - * Get Start Color - * - * @return PHPExcel_Style_Color - */ - public function getStartColor() { - return $this->_startColor; - } + /** + * Get Start Color + * + * @return PHPExcel_Style_Color + */ + public function getStartColor() { + return $this->_startColor; + } - /** - * Set Start Color - * - * @param PHPExcel_Style_Color $pValue - * @throws Exception - * @return PHPExcel_Style_Fill - */ - public function setStartColor(PHPExcel_Style_Color $pValue = null) { + /** + * Set Start Color + * + * @param PHPExcel_Style_Color $pValue + * @throws Exception + * @return PHPExcel_Style_Fill + */ + public function setStartColor(PHPExcel_Style_Color $pValue = null) { // make sure parameter is a real color and not a supervisor $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; @@ -336,25 +334,25 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable $this->_startColor = $color; } return $this; - } + } - /** - * Get End Color - * - * @return PHPExcel_Style_Color - */ - public function getEndColor() { - return $this->_endColor; - } + /** + * Get End Color + * + * @return PHPExcel_Style_Color + */ + public function getEndColor() { + return $this->_endColor; + } - /** - * Set End Color - * - * @param PHPExcel_Style_Color $pValue - * @throws Exception - * @return PHPExcel_Style_Fill - */ - public function setEndColor(PHPExcel_Style_Color $pValue = null) { + /** + * Set End Color + * + * @param PHPExcel_Style_Color $pValue + * @throws Exception + * @return PHPExcel_Style_Fill + */ + public function setEndColor(PHPExcel_Style_Color $pValue = null) { // make sure parameter is a real color and not a supervisor $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; @@ -365,7 +363,7 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable $this->_endColor = $color; } return $this; - } + } /** * Get hash code @@ -376,14 +374,14 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable if ($this->_isSupervisor) { return $this->getSharedComponent()->getHashCode(); } - return md5( - $this->getFillType() - . $this->getRotation() - . $this->getStartColor()->getHashCode() - . $this->getEndColor()->getHashCode() - . __CLASS__ - ); - } + return md5( + $this->getFillType() + . $this->getRotation() + . $this->getStartColor()->getHashCode() + . $this->getEndColor()->getHashCode() + . __CLASS__ + ); + } /** * Implement PHP __clone to create a deep clone, not just a shallow copy. diff --git a/Classes/PHPExcel/Style/Font.php b/Classes/PHPExcel/Style/Font.php index 07c5f451..cb7be657 100644 --- a/Classes/PHPExcel/Style/Font.php +++ b/Classes/PHPExcel/Style/Font.php @@ -19,10 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version ##VERSION##, ##DATE## */ @@ -30,7 +30,7 @@ * PHPExcel_Style_Font * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Style_Font implements PHPExcel_IComparable @@ -43,53 +43,60 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable const UNDERLINE_SINGLEACCOUNTING = 'singleAccounting'; /** - * Name + * Font Name * * @var string */ - private $_name; + private $_name = 'Calibri'; + + /** + * Font Size + * + * @var float + */ + private $_size = 11; /** * Bold * * @var boolean */ - private $_bold; + private $_bold = false; /** * Italic * * @var boolean */ - private $_italic; + private $_italic = false; /** * Superscript * * @var boolean */ - private $_superScript; + private $_superScript = false; /** * Subscript * * @var boolean */ - private $_subScript; + private $_subScript = false; /** * Underline * * @var string */ - private $_underline; + private $_underline = PHPExcel_Style_Font::UNDERLINE_NONE; /** * Strikethrough * * @var boolean */ - private $_strikethrough; + private $_strikethrough = false; /** * Foreground color @@ -120,29 +127,21 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable private $_parent; /** - * Create a new PHPExcel_Style_Font - */ - public function __construct($isSupervisor = false) - { - // Supervisor? + * Create a new PHPExcel_Style_Font + */ + public function __construct($isSupervisor = false) + { + // Supervisor? $this->_isSupervisor = $isSupervisor; - // Initialise values - $this->_name = 'Calibri'; - $this->_size = 11; - $this->_bold = false; - $this->_italic = false; - $this->_superScript = false; - $this->_subScript = false; - $this->_underline = PHPExcel_Style_Font::UNDERLINE_NONE; - $this->_strikethrough = false; + // Initialise values $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); // bind parent if we are a supervisor if ($isSupervisor) { $this->_color->bindParent($this, '_color'); } - } + } /** * Bind parent. Only used for supervisor @@ -219,28 +218,28 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable return array('font' => $array); } - /** - * Apply styles from array - * - * - * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray( - * array( - * 'name' => 'Arial', - * 'bold' => true, - * 'italic' => false, - * 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE, - * 'strike' => false, - * 'color' => array( - * 'rgb' => '808080' - * ) - * ) - * ); - * - * - * @param array $pStyles Array containing style information - * @throws Exception - * @return PHPExcel_Style_Font - */ + /** + * Apply styles from array + * + * + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray( + * array( + * 'name' => 'Arial', + * 'bold' => true, + * 'italic' => false, + * 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE, + * 'strike' => false, + * 'color' => array( + * 'rgb' => '808080' + * ) + * ) + * ); + * + * + * @param array $pStyles Array containing style information + * @throws Exception + * @return PHPExcel_Style_Font + */ public function applyFromArray($pStyles = null) { if (is_array($pStyles)) { if ($this->_isSupervisor) { @@ -280,28 +279,28 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable return $this; } - /** - * Get Name - * - * @return string - */ - public function getName() { + /** + * Get Name + * + * @return string + */ + public function getName() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getName(); } - return $this->_name; - } + return $this->_name; + } - /** - * Set Name - * - * @param string $pValue - * @return PHPExcel_Style_Font - */ - public function setName($pValue = 'Calibri') { - if ($pValue == '') { - $pValue = 'Calibri'; - } + /** + * Set Name + * + * @param string $pValue + * @return PHPExcel_Style_Font + */ + public function setName($pValue = 'Calibri') { + if ($pValue == '') { + $pValue = 'Calibri'; + } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('name' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); @@ -309,30 +308,30 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable $this->_name = $pValue; } return $this; - } + } - /** - * Get Size - * - * @return double - */ - public function getSize() { + /** + * Get Size + * + * @return double + */ + public function getSize() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getSize(); } - return $this->_size; - } + return $this->_size; + } - /** - * Set Size - * - * @param double $pValue - * @return PHPExcel_Style_Font - */ - public function setSize($pValue = 10) { - if ($pValue == '') { - $pValue = 10; - } + /** + * Set Size + * + * @param double $pValue + * @return PHPExcel_Style_Font + */ + public function setSize($pValue = 10) { + if ($pValue == '') { + $pValue = 10; + } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('size' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); @@ -340,30 +339,30 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable $this->_size = $pValue; } return $this; - } + } - /** - * Get Bold - * - * @return boolean - */ - public function getBold() { + /** + * Get Bold + * + * @return boolean + */ + public function getBold() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getBold(); } - return $this->_bold; - } + return $this->_bold; + } - /** - * Set Bold - * - * @param boolean $pValue - * @return PHPExcel_Style_Font - */ - public function setBold($pValue = false) { - if ($pValue == '') { - $pValue = false; - } + /** + * Set Bold + * + * @param boolean $pValue + * @return PHPExcel_Style_Font + */ + public function setBold($pValue = false) { + if ($pValue == '') { + $pValue = false; + } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('bold' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); @@ -371,30 +370,30 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable $this->_bold = $pValue; } return $this; - } + } - /** - * Get Italic - * - * @return boolean - */ - public function getItalic() { + /** + * Get Italic + * + * @return boolean + */ + public function getItalic() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getItalic(); } - return $this->_italic; - } + return $this->_italic; + } - /** - * Set Italic - * - * @param boolean $pValue - * @return PHPExcel_Style_Font - */ - public function setItalic($pValue = false) { - if ($pValue == '') { - $pValue = false; - } + /** + * Set Italic + * + * @param boolean $pValue + * @return PHPExcel_Style_Font + */ + public function setItalic($pValue = false) { + if ($pValue == '') { + $pValue = false; + } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('italic' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); @@ -402,30 +401,30 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable $this->_italic = $pValue; } return $this; - } + } - /** - * Get SuperScript - * - * @return boolean - */ - public function getSuperScript() { + /** + * Get SuperScript + * + * @return boolean + */ + public function getSuperScript() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getSuperScript(); } - return $this->_superScript; - } + return $this->_superScript; + } - /** - * Set SuperScript - * - * @param boolean $pValue - * @return PHPExcel_Style_Font - */ - public function setSuperScript($pValue = false) { - if ($pValue == '') { - $pValue = false; - } + /** + * Set SuperScript + * + * @param boolean $pValue + * @return PHPExcel_Style_Font + */ + public function setSuperScript($pValue = false) { + if ($pValue == '') { + $pValue = false; + } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('superScript' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); @@ -434,30 +433,30 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable $this->_subScript = !$pValue; } return $this; - } + } - /** - * Get SubScript - * - * @return boolean - */ - public function getSubScript() { + /** + * Get SubScript + * + * @return boolean + */ + public function getSubScript() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getSubScript(); } - return $this->_subScript; - } + return $this->_subScript; + } - /** - * Set SubScript - * - * @param boolean $pValue - * @return PHPExcel_Style_Font - */ - public function setSubScript($pValue = false) { - if ($pValue == '') { - $pValue = false; - } + /** + * Set SubScript + * + * @param boolean $pValue + * @return PHPExcel_Style_Font + */ + public function setSubScript($pValue = false) { + if ($pValue == '') { + $pValue = false; + } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('subScript' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); @@ -466,30 +465,30 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable $this->_superScript = !$pValue; } return $this; - } + } - /** - * Get Underline - * - * @return string - */ - public function getUnderline() { + /** + * Get Underline + * + * @return string + */ + public function getUnderline() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getUnderline(); } - return $this->_underline; - } + return $this->_underline; + } - /** - * Set Underline - * - * @param string $pValue PHPExcel_Style_Font underline type - * @return PHPExcel_Style_Font - */ - public function setUnderline($pValue = PHPExcel_Style_Font::UNDERLINE_NONE) { - if ($pValue == '') { - $pValue = PHPExcel_Style_Font::UNDERLINE_NONE; - } + /** + * Set Underline + * + * @param string $pValue PHPExcel_Style_Font underline type + * @return PHPExcel_Style_Font + */ + public function setUnderline($pValue = PHPExcel_Style_Font::UNDERLINE_NONE) { + if ($pValue == '') { + $pValue = PHPExcel_Style_Font::UNDERLINE_NONE; + } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('underline' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); @@ -497,51 +496,51 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable $this->_underline = $pValue; } return $this; - } + } - /** - * Get Striketrough - * - * @deprecated Use getStrikethrough() instead. - * @return boolean - */ - public function getStriketrough() { - return $this->getStrikethrough(); - } + /** + * Get Striketrough + * + * @deprecated Use getStrikethrough() instead. + * @return boolean + */ + public function getStriketrough() { + return $this->getStrikethrough(); + } - /** - * Set Striketrough - * - * @deprecated Use setStrikethrough() instead. - * @param boolean $pValue - * @return PHPExcel_Style_Font - */ - public function setStriketrough($pValue = false) { - return $this->setStrikethrough($pValue); - } + /** + * Set Striketrough + * + * @deprecated Use setStrikethrough() instead. + * @param boolean $pValue + * @return PHPExcel_Style_Font + */ + public function setStriketrough($pValue = false) { + return $this->setStrikethrough($pValue); + } - /** - * Get Strikethrough - * - * @return boolean - */ - public function getStrikethrough() { + /** + * Get Strikethrough + * + * @return boolean + */ + public function getStrikethrough() { if ($this->_isSupervisor) { return $this->getSharedComponent()->getStrikethrough(); } - return $this->_strikethrough; - } + return $this->_strikethrough; + } - /** - * Set Strikethrough - * - * @param boolean $pValue - * @return PHPExcel_Style_Font - */ - public function setStrikethrough($pValue = false) { - if ($pValue == '') { - $pValue = false; - } + /** + * Set Strikethrough + * + * @param boolean $pValue + * @return PHPExcel_Style_Font + */ + public function setStrikethrough($pValue = false) { + if ($pValue == '') { + $pValue = false; + } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('strike' => $pValue)); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); @@ -549,25 +548,25 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable $this->_strikethrough = $pValue; } return $this; - } + } - /** - * Get Color - * - * @return PHPExcel_Style_Color - */ - public function getColor() { - return $this->_color; - } + /** + * Get Color + * + * @return PHPExcel_Style_Color + */ + public function getColor() { + return $this->_color; + } - /** - * Set Color - * - * @param PHPExcel_Style_Color $pValue - * @throws Exception - * @return PHPExcel_Style_Font - */ - public function setColor(PHPExcel_Style_Color $pValue = null) { + /** + * Set Color + * + * @param PHPExcel_Style_Color $pValue + * @throws Exception + * @return PHPExcel_Style_Font + */ + public function setColor(PHPExcel_Style_Color $pValue = null) { // make sure parameter is a real color and not a supervisor $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; @@ -578,7 +577,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable $this->_color = $color; } return $this; - } + } /** * Get hash code @@ -589,19 +588,19 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable if ($this->_isSupervisor) { return $this->getSharedComponent()->getHashCode(); } - return md5( - $this->_name - . $this->_size - . ($this->_bold ? 't' : 'f') - . ($this->_italic ? 't' : 'f') + return md5( + $this->_name + . $this->_size + . ($this->_bold ? 't' : 'f') + . ($this->_italic ? 't' : 'f') . ($this->_superScript ? 't' : 'f') . ($this->_subScript ? 't' : 'f') - . $this->_underline - . ($this->_strikethrough ? 't' : 'f') - . $this->_color->getHashCode() - . __CLASS__ - ); - } + . $this->_underline + . ($this->_strikethrough ? 't' : 'f') + . $this->_color->getHashCode() + . __CLASS__ + ); + } /** * Implement PHP __clone to create a deep clone, not just a shallow copy. diff --git a/Classes/PHPExcel/Style/NumberFormat.php b/Classes/PHPExcel/Style/NumberFormat.php index f4e957dc..41d5da7d 100644 --- a/Classes/PHPExcel/Style/NumberFormat.php +++ b/Classes/PHPExcel/Style/NumberFormat.php @@ -19,10 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version ##VERSION##, ##DATE## + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version ##VERSION##, ##DATE## */ @@ -30,7 +30,7 @@ * PHPExcel_Style_NumberFormat * * @category PHPExcel - * @package PHPExcel_Style + * @package PHPExcel_Style * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable @@ -94,14 +94,14 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable * * @var string */ - private $_formatCode; + private $_formatCode = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; /** * Built-in format Code * * @var string */ - private $_builtInFormatCode; + private $_builtInFormatCode = 0; /** * Parent Borders @@ -131,10 +131,6 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable { // Supervisor? $this->_isSupervisor = $isSupervisor; - - // Initialise values - $this->_formatCode = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; - $this->_builtInFormatCode = 0; } /** @@ -217,9 +213,9 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable * * * $objPHPExcel->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray( - * array( - * 'code' => PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE - * ) + * array( + * 'code' => PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE + * ) * ); * * @@ -497,8 +493,8 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable /** * Convert a value in a pre-defined format to a PHP string * - * @param mixed $value Value to format - * @param string $format Format code + * @param mixed $value Value to format + * @param string $format Format code * @param array $callBack Callback function for additional formatting of string * @return string Formatted string */ @@ -623,7 +619,7 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable // Scale thousands, millions,... // This is indicated by a number of commas after a digit placeholder: - // #, or 0.0,, + // #, or 0.0,, $scale = 1; // same as no scale $matches = array(); if (preg_match('/(#|0)(,+)/', $format, $matches)) { diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index 8840c682..cad03fe5 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -337,13 +337,13 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable $this->_pageSetup = new PHPExcel_Worksheet_PageSetup(); // Set page margins - $this->_pageMargins = new PHPExcel_Worksheet_PageMargins(); + $this->_pageMargins = new PHPExcel_Worksheet_PageMargins(); // Set page header/footer $this->_headerFooter = new PHPExcel_Worksheet_HeaderFooter(); // Set sheet view - $this->_sheetView = new PHPExcel_Worksheet_SheetView(); + $this->_sheetView = new PHPExcel_Worksheet_SheetView(); // Drawing collection $this->_drawingCollection = new ArrayObject(); @@ -351,14 +351,6 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable // Protection $this->_protection = new PHPExcel_Worksheet_Protection(); - // Gridlines - $this->_showGridlines = true; - $this->_printGridlines = false; - - // Outline summary - $this->_showSummaryBelow = true; - $this->_showSummaryRight = true; - // Default row dimension $this->_defaultRowDimension = new PHPExcel_Worksheet_RowDimension(null); diff --git a/Classes/PHPExcel/Worksheet/ColumnDimension.php b/Classes/PHPExcel/Worksheet/ColumnDimension.php index 5b80bcf6..0b79dda6 100644 --- a/Classes/PHPExcel/Worksheet/ColumnDimension.php +++ b/Classes/PHPExcel/Worksheet/ColumnDimension.php @@ -8,12 +8,12 @@ * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA @@ -34,14 +34,14 @@ * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_ColumnDimension -{ +{ /** * Column index * * @var int */ private $_columnIndex; - + /** * Column width * @@ -49,35 +49,35 @@ class PHPExcel_Worksheet_ColumnDimension * * @var double */ - private $_width; - + private $_width = -1; + /** * Auto size? * * @var bool */ - private $_autoSize; - + private $_autoSize = false; + /** * Visible? * * @var bool */ - private $_visible; - + private $_visible = true; + /** * Outline level * * @var int */ - private $_outlineLevel = 0; - + private $_outlineLevel = 0; + /** * Collapsed * * @var bool */ - private $_collapsed; + private $_collapsed = false; /** * Index to cellXf @@ -95,16 +95,11 @@ class PHPExcel_Worksheet_ColumnDimension { // Initialise values $this->_columnIndex = $pIndex; - $this->_width = -1; - $this->_autoSize = false; - $this->_visible = true; - $this->_outlineLevel = 0; - $this->_collapsed = false; // set default index to cellXf $this->_xfIndex = 0; } - + /** * Get ColumnIndex * @@ -113,7 +108,7 @@ class PHPExcel_Worksheet_ColumnDimension public function getColumnIndex() { return $this->_columnIndex; } - + /** * Set ColumnIndex * @@ -124,7 +119,7 @@ class PHPExcel_Worksheet_ColumnDimension $this->_columnIndex = $pValue; return $this; } - + /** * Get Width * @@ -133,7 +128,7 @@ class PHPExcel_Worksheet_ColumnDimension public function getWidth() { return $this->_width; } - + /** * Set Width * @@ -144,7 +139,7 @@ class PHPExcel_Worksheet_ColumnDimension $this->_width = $pValue; return $this; } - + /** * Get Auto Size * @@ -153,7 +148,7 @@ class PHPExcel_Worksheet_ColumnDimension public function getAutoSize() { return $this->_autoSize; } - + /** * Set Auto Size * @@ -164,7 +159,7 @@ class PHPExcel_Worksheet_ColumnDimension $this->_autoSize = $pValue; return $this; } - + /** * Get Visible * @@ -173,7 +168,7 @@ class PHPExcel_Worksheet_ColumnDimension public function getVisible() { return $this->_visible; } - + /** * Set Visible * @@ -184,7 +179,7 @@ class PHPExcel_Worksheet_ColumnDimension $this->_visible = $pValue; return $this; } - + /** * Get Outline Level * @@ -193,7 +188,7 @@ class PHPExcel_Worksheet_ColumnDimension public function getOutlineLevel() { return $this->_outlineLevel; } - + /** * Set Outline Level * @@ -207,11 +202,11 @@ class PHPExcel_Worksheet_ColumnDimension if ($pValue < 0 || $pValue > 7) { throw new Exception("Outline level must range between 0 and 7."); } - + $this->_outlineLevel = $pValue; return $this; } - + /** * Get Collapsed * @@ -220,7 +215,7 @@ class PHPExcel_Worksheet_ColumnDimension public function getCollapsed() { return $this->_collapsed; } - + /** * Set Collapsed * @@ -231,7 +226,7 @@ class PHPExcel_Worksheet_ColumnDimension $this->_collapsed = $pValue; return $this; } - + /** * Get index to cellXf * diff --git a/Classes/PHPExcel/Worksheet/HeaderFooter.php b/Classes/PHPExcel/Worksheet/HeaderFooter.php index 19bb511a..9f8aeb0a 100644 --- a/Classes/PHPExcel/Worksheet/HeaderFooter.php +++ b/Classes/PHPExcel/Worksheet/HeaderFooter.php @@ -108,70 +108,70 @@ class PHPExcel_Worksheet_HeaderFooter * * @var string */ - private $_oddHeader; + private $_oddHeader = ''; /** * OddFooter * * @var string */ - private $_oddFooter; + private $_oddFooter = ''; /** * EvenHeader * * @var string */ - private $_evenHeader; + private $_evenHeader = ''; /** * EvenFooter * * @var string */ - private $_evenFooter; + private $_evenFooter = ''; /** * FirstHeader * * @var string */ - private $_firstHeader; + private $_firstHeader = ''; /** * FirstFooter * * @var string */ - private $_firstFooter; + private $_firstFooter = ''; /** * Different header for Odd/Even, defaults to false * * @var boolean */ - private $_differentOddEven; + private $_differentOddEven = false; /** * Different header for first page, defaults to false * * @var boolean */ - private $_differentFirst; + private $_differentFirst = false; /** * Scale with document, defaults to true * * @var boolean */ - private $_scaleWithDocument; + private $_scaleWithDocument = true; /** * Align with margins, defaults to true * * @var boolean */ - private $_alignWithMargins; + private $_alignWithMargins = true; /** * Header/footer images @@ -185,18 +185,6 @@ class PHPExcel_Worksheet_HeaderFooter */ public function __construct() { - // Initialise values - $this->_oddHeader = ''; - $this->_oddFooter = ''; - $this->_evenHeader = ''; - $this->_evenFooter = ''; - $this->_firstHeader = ''; - $this->_firstFooter = ''; - $this->_differentOddEven = false; - $this->_differentFirst = false; - $this->_scaleWithDocument = true; - $this->_alignWithMargins = true; - $this->_headerFooterImages = array(); } /** diff --git a/Classes/PHPExcel/Worksheet/PageMargins.php b/Classes/PHPExcel/Worksheet/PageMargins.php index 9f26e303..a953c65a 100644 --- a/Classes/PHPExcel/Worksheet/PageMargins.php +++ b/Classes/PHPExcel/Worksheet/PageMargins.php @@ -8,12 +8,12 @@ * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA @@ -34,63 +34,56 @@ * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_PageMargins -{ +{ /** * Left * * @var double */ - private $_left; - + private $_left = 0.7; + /** * Right * * @var double */ - private $_right; - + private $_right = 0.7; + /** * Top * * @var double */ - private $_top; - + private $_top = 0.75; + /** * Bottom * * @var double */ - private $_bottom; - + private $_bottom = 0.75; + /** * Header * * @var double */ - private $_header; - + private $_header = 0.3; + /** * Footer * * @var double */ - private $_footer; - + private $_footer = 0.3; + /** * Create a new PHPExcel_Worksheet_PageMargins */ public function __construct() { - // Initialise values - $this->_left = 0.7; - $this->_right = 0.7; - $this->_top = 0.75; - $this->_bottom = 0.75; - $this->_header = 0.3; - $this->_footer = 0.3; } - + /** * Get Left * @@ -99,7 +92,7 @@ class PHPExcel_Worksheet_PageMargins public function getLeft() { return $this->_left; } - + /** * Set Left * @@ -110,7 +103,7 @@ class PHPExcel_Worksheet_PageMargins $this->_left = $pValue; return $this; } - + /** * Get Right * @@ -119,7 +112,7 @@ class PHPExcel_Worksheet_PageMargins public function getRight() { return $this->_right; } - + /** * Set Right * @@ -130,7 +123,7 @@ class PHPExcel_Worksheet_PageMargins $this->_right = $pValue; return $this; } - + /** * Get Top * @@ -139,7 +132,7 @@ class PHPExcel_Worksheet_PageMargins public function getTop() { return $this->_top; } - + /** * Set Top * @@ -150,7 +143,7 @@ class PHPExcel_Worksheet_PageMargins $this->_top = $pValue; return $this; } - + /** * Get Bottom * @@ -159,7 +152,7 @@ class PHPExcel_Worksheet_PageMargins public function getBottom() { return $this->_bottom; } - + /** * Set Bottom * @@ -170,7 +163,7 @@ class PHPExcel_Worksheet_PageMargins $this->_bottom = $pValue; return $this; } - + /** * Get Header * @@ -179,7 +172,7 @@ class PHPExcel_Worksheet_PageMargins public function getHeader() { return $this->_header; } - + /** * Set Header * @@ -190,7 +183,7 @@ class PHPExcel_Worksheet_PageMargins $this->_header = $pValue; return $this; } - + /** * Get Footer * @@ -199,7 +192,7 @@ class PHPExcel_Worksheet_PageMargins public function getFooter() { return $this->_footer; } - + /** * Set Footer * @@ -210,7 +203,7 @@ class PHPExcel_Worksheet_PageMargins $this->_footer = $pValue; return $this; } - + /** * Implement PHP __clone to create a deep clone, not just a shallow copy. */ diff --git a/Classes/PHPExcel/Worksheet/PageSetup.php b/Classes/PHPExcel/Worksheet/PageSetup.php index d28246fb..db85d1a1 100644 --- a/Classes/PHPExcel/Worksheet/PageSetup.php +++ b/Classes/PHPExcel/Worksheet/PageSetup.php @@ -189,14 +189,14 @@ class PHPExcel_Worksheet_PageSetup * * @var int */ - private $_paperSize; + private $_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER; /** * Orientation * * @var string */ - private $_orientation; + private $_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT; /** * Scale (Print Scale) @@ -206,7 +206,7 @@ class PHPExcel_Worksheet_PageSetup * * @var int? */ - private $_scale; + private $_scale = 100; /** * Fit To Page @@ -214,7 +214,7 @@ class PHPExcel_Worksheet_PageSetup * * @var boolean */ - private $_fitToPage; + private $_fitToPage = false; /** * Fit To Height @@ -222,7 +222,7 @@ class PHPExcel_Worksheet_PageSetup * * @var int? */ - private $_fitToHeight; + private $_fitToHeight = 1; /** * Fit To Width @@ -230,7 +230,7 @@ class PHPExcel_Worksheet_PageSetup * * @var int? */ - private $_fitToWidth; + private $_fitToWidth = 1; /** * Columns to repeat at left @@ -279,19 +279,6 @@ class PHPExcel_Worksheet_PageSetup */ public function __construct() { - // Initialise values - $this->_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER; - $this->_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT; - $this->_scale = 100; - $this->_fitToPage = false; - $this->_fitToHeight = 1; - $this->_fitToWidth = 1; - $this->_columnsToRepeatAtLeft = array('', ''); - $this->_rowsToRepeatAtTop = array(0, 0); - $this->_horizontalCentered = false; - $this->_verticalCentered = false; - $this->_printArea = null; - $this->_firstPageNumber = null; } /** diff --git a/Classes/PHPExcel/Worksheet/Protection.php b/Classes/PHPExcel/Worksheet/Protection.php index 84c7fc0f..757a43cd 100644 --- a/Classes/PHPExcel/Worksheet/Protection.php +++ b/Classes/PHPExcel/Worksheet/Protection.php @@ -40,143 +40,125 @@ class PHPExcel_Worksheet_Protection * * @var boolean */ - private $_sheet; + private $_sheet = false; /** * Objects * * @var boolean */ - private $_objects; + private $_objects = false; /** * Scenarios * * @var boolean */ - private $_scenarios; + private $_scenarios = false; /** * Format cells * * @var boolean */ - private $_formatCells; + private $_formatCells = false; /** * Format columns * * @var boolean */ - private $_formatColumns; + private $_formatColumns = false; /** * Format rows * * @var boolean */ - private $_formatRows; + private $_formatRows = false; /** * Insert columns * * @var boolean */ - private $_insertColumns; + private $_insertColumns = false; /** * Insert rows * * @var boolean */ - private $_insertRows; + private $_insertRows = false; /** * Insert hyperlinks * * @var boolean */ - private $_insertHyperlinks; + private $_insertHyperlinks = false; /** * Delete columns * * @var boolean */ - private $_deleteColumns; + private $_deleteColumns = false; /** * Delete rows * * @var boolean */ - private $_deleteRows; + private $_deleteRows = false; /** * Select locked cells * * @var boolean */ - private $_selectLockedCells; + private $_selectLockedCells = false; /** * Sort * * @var boolean */ - private $_sort; + private $_sort = false; /** * AutoFilter * * @var boolean */ - private $_autoFilter; + private $_autoFilter = false; /** * Pivot tables * * @var boolean */ - private $_pivotTables; + private $_pivotTables = false; /** * Select unlocked cells * * @var boolean */ - private $_selectUnlockedCells; + private $_selectUnlockedCells = false; /** * Password * * @var string */ - private $_password; + private $_password = ''; /** * Create a new PHPExcel_Worksheet_Protection */ public function __construct() { - // Initialise values - $this->_sheet = false; - $this->_objects = false; - $this->_scenarios = false; - $this->_formatCells = false; - $this->_formatColumns = false; - $this->_formatRows = false; - $this->_insertColumns = false; - $this->_insertRows = false; - $this->_insertHyperlinks = false; - $this->_deleteColumns = false; - $this->_deleteRows = false; - $this->_selectLockedCells = false; - $this->_sort = false; - $this->_autoFilter = false; - $this->_pivotTables = false; - $this->_selectUnlockedCells = false; - $this->_password = ''; } /** diff --git a/Classes/PHPExcel/Worksheet/RowDimension.php b/Classes/PHPExcel/Worksheet/RowDimension.php index 91c85bc5..e5a3d185 100644 --- a/Classes/PHPExcel/Worksheet/RowDimension.php +++ b/Classes/PHPExcel/Worksheet/RowDimension.php @@ -8,12 +8,12 @@ * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA @@ -34,14 +34,14 @@ * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_RowDimension -{ +{ /** * Row index * * @var int */ private $_rowIndex; - + /** * Row height (in pt) * @@ -49,28 +49,28 @@ class PHPExcel_Worksheet_RowDimension * * @var double */ - private $_rowHeight; - + private $_rowHeight = -1; + /** * Visible? * * @var bool */ - private $_visible; - + private $_visible = true; + /** * Outline level * * @var int */ - private $_outlineLevel = 0; - + private $_outlineLevel = 0; + /** * Collapsed * * @var bool */ - private $_collapsed; + private $_collapsed = false; /** * Index to cellXf. Null value means row has no explicit cellXf format. @@ -88,15 +88,11 @@ class PHPExcel_Worksheet_RowDimension { // Initialise values $this->_rowIndex = $pIndex; - $this->_rowHeight = -1; - $this->_visible = true; - $this->_outlineLevel = 0; - $this->_collapsed = false; // set row dimension as unformatted by default $this->_xfIndex = null; } - + /** * Get Row Index * @@ -105,7 +101,7 @@ class PHPExcel_Worksheet_RowDimension public function getRowIndex() { return $this->_rowIndex; } - + /** * Set Row Index * @@ -116,7 +112,7 @@ class PHPExcel_Worksheet_RowDimension $this->_rowIndex = $pValue; return $this; } - + /** * Get Row Height * @@ -125,7 +121,7 @@ class PHPExcel_Worksheet_RowDimension public function getRowHeight() { return $this->_rowHeight; } - + /** * Set Row Height * @@ -136,7 +132,7 @@ class PHPExcel_Worksheet_RowDimension $this->_rowHeight = $pValue; return $this; } - + /** * Get Visible * @@ -145,7 +141,7 @@ class PHPExcel_Worksheet_RowDimension public function getVisible() { return $this->_visible; } - + /** * Set Visible * @@ -156,7 +152,7 @@ class PHPExcel_Worksheet_RowDimension $this->_visible = $pValue; return $this; } - + /** * Get Outline Level * @@ -165,7 +161,7 @@ class PHPExcel_Worksheet_RowDimension public function getOutlineLevel() { return $this->_outlineLevel; } - + /** * Set Outline Level * @@ -179,11 +175,11 @@ class PHPExcel_Worksheet_RowDimension if ($pValue < 0 || $pValue > 7) { throw new Exception("Outline level must range between 0 and 7."); } - + $this->_outlineLevel = $pValue; return $this; } - + /** * Get Collapsed * @@ -192,7 +188,7 @@ class PHPExcel_Worksheet_RowDimension public function getCollapsed() { return $this->_collapsed; } - + /** * Set Collapsed * diff --git a/Classes/PHPExcel/Worksheet/SheetView.php b/Classes/PHPExcel/Worksheet/SheetView.php index 55fb3d4f..58ed98a8 100644 --- a/Classes/PHPExcel/Worksheet/SheetView.php +++ b/Classes/PHPExcel/Worksheet/SheetView.php @@ -37,30 +37,27 @@ class PHPExcel_Worksheet_SheetView { /** * ZoomScale - * + * * Valid values range from 10 to 400. * * @var int */ - private $_zoomScale; + private $_zoomScale = 100; /** * ZoomScaleNormal - * + * * Valid values range from 10 to 400. * * @var int */ - private $_zoomScaleNormal; + private $_zoomScaleNormal = 100; /** * Create a new PHPExcel_Worksheet_SheetView */ public function __construct() { - // Initialise values - $this->_zoomScale = 100; - $this->_zoomScaleNormal = 100; } /** @@ -91,7 +88,7 @@ class PHPExcel_Worksheet_SheetView } return $this; } - + /** * Get ZoomScaleNormal * diff --git a/Classes/PHPExcel/Writer/CSV.php b/Classes/PHPExcel/Writer/CSV.php index 9f271007..fea4366b 100644 --- a/Classes/PHPExcel/Writer/CSV.php +++ b/Classes/PHPExcel/Writer/CSV.php @@ -46,28 +46,28 @@ class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter { * * @var string */ - private $_delimiter; + private $_delimiter = ','; /** * Enclosure * * @var string */ - private $_enclosure; + private $_enclosure = '"'; /** * Line ending * * @var string */ - private $_lineEnding; + private $_lineEnding = PHP_EOL; /** * Sheet index to write * * @var int */ - private $_sheetIndex; + private $_sheetIndex = 0; /** * Pre-calculate formulas @@ -90,10 +90,6 @@ class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter { */ public function __construct(PHPExcel $phpExcel) { $this->_phpExcel = $phpExcel; - $this->_delimiter = ','; - $this->_enclosure = '"'; - $this->_lineEnding = PHP_EOL; - $this->_sheetIndex = 0; } /** diff --git a/Classes/PHPExcel/Writer/Excel5.php b/Classes/PHPExcel/Writer/Excel5.php index 63028b70..235ba441 100644 --- a/Classes/PHPExcel/Writer/Excel5.php +++ b/Classes/PHPExcel/Writer/Excel5.php @@ -40,7 +40,7 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter * * @var boolean */ - private $_preCalculateFormulas; + private $_preCalculateFormulas = true; /** * PHPExcel object @@ -54,28 +54,28 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter * * @var integer */ - private $_BIFF_version; + private $_BIFF_version = 0x0600; /** * Total number of shared strings in workbook * * @var int */ - private $_str_total; + private $_str_total = 0; /** * Number of unique shared strings in workbook * * @var int */ - private $_str_unique; + private $_str_unique = 0; /** * Array of unique shared strings in workbook * * @var array */ - private $_str_table; + private $_str_table = array(); /** * Color cache. Mapping between RGB value and color index. @@ -105,15 +105,9 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter * @param PHPExcel $phpExcel PHPExcel object */ public function __construct(PHPExcel $phpExcel) { - $this->_preCalculateFormulas = true; $this->_phpExcel = $phpExcel; - $this->_BIFF_version = 0x0600; - - $this->_str_total = 0; - $this->_str_unique = 0; - $this->_str_table = array(); - $this->_parser = new PHPExcel_Writer_Excel5_Parser($this->_BIFF_version); + $this->_parser = new PHPExcel_Writer_Excel5_Parser($this->_BIFF_version); } /** diff --git a/Classes/PHPExcel/Writer/HTML.php b/Classes/PHPExcel/Writer/HTML.php index a8f5c29e..b42ed4b4 100644 --- a/Classes/PHPExcel/Writer/HTML.php +++ b/Classes/PHPExcel/Writer/HTML.php @@ -46,7 +46,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { * * @var int */ - private $_sheetIndex; + private $_sheetIndex = 0; /** * Pre-calculate formulas @@ -60,7 +60,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { * * @var string */ - private $_imagesRoot = '.'; + private $_imagesRoot = '.'; /** * Use inline CSS? @@ -95,28 +95,28 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { * * @var boolean */ - private $_spansAreCalculated; + private $_spansAreCalculated = false; /** * Excel cells that should not be written as HTML cells * * @var array */ - private $_isSpannedCell; + private $_isSpannedCell = array(); /** * Excel cells that are upper-left corner in a cell merge * * @var array */ - private $_isBaseCell; + private $_isBaseCell = array(); /** * Excel rows that should not be written as HTML rows * * @var array */ - private $_isSpannedRow; + private $_isSpannedRow = array(); /** * Is the current writer creating PDF? @@ -140,13 +140,6 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { public function __construct(PHPExcel $phpExcel) { $this->_phpExcel = $phpExcel; $this->_defaultFont = $this->_phpExcel->getDefaultStyle()->getFont(); - $this->_sheetIndex = 0; - $this->_imagesRoot = '.'; - - $this->_spansAreCalculated = false; - $this->_isSpannedCell = array(); - $this->_isBaseCell = array(); - $this->_isSpannedRow = array(); } /**