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
This commit is contained in:
Mark Baker 2010-12-09 12:07:50 +00:00
parent 500a8e763e
commit 1fad8bd2dd
23 changed files with 800 additions and 902 deletions

View File

@ -49,7 +49,7 @@ class PHPExcel_DocumentProperties
* *
* @var string * @var string
*/ */
private $_creator; private $_creator = 'Unknown Creator';
/** /**
* LastModifiedBy * LastModifiedBy
@ -77,42 +77,49 @@ class PHPExcel_DocumentProperties
* *
* @var string * @var string
*/ */
private $_title; private $_title = 'Untitled Spreadsheet';
/** /**
* Description * Description
* *
* @var string * @var string
*/ */
private $_description; private $_description = '';
/** /**
* Subject * Subject
* *
* @var string * @var string
*/ */
private $_subject; private $_subject = '';
/** /**
* Keywords * Keywords
* *
* @var string * @var string
*/ */
private $_keywords; private $_keywords = '';
/** /**
* Category * Category
* *
* @var string * @var string
*/ */
private $_category; private $_category = '';
/**
* Manager
*
* @var string
*/
private $_manager = '';
/** /**
* Company * Company
* *
* @var string * @var string
*/ */
private $_company; private $_company = 'Microsoft Corporation';
/** /**
* Custom Properties * Custom Properties
@ -128,17 +135,9 @@ class PHPExcel_DocumentProperties
public function __construct() public function __construct()
{ {
// Initialise values // Initialise values
$this->_creator = 'Unknown Creator';
$this->_lastModifiedBy = $this->_creator; $this->_lastModifiedBy = $this->_creator;
$this->_created = time(); $this->_created = time();
$this->_modified = time(); $this->_modified = time();
$this->_title = "Untitled Spreadsheet";
$this->_subject = '';
$this->_description = '';
$this->_keywords = '';
$this->_category = '';
$this->_manager = '';
$this->_company = 'Microsoft Corporation';
} }
/** /**

View File

@ -50,7 +50,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
* @access private * @access private
* @var string * @var string
*/ */
private $_inputEncoding; private $_inputEncoding = 'UTF-8';
/** /**
* Delimiter * Delimiter
@ -58,7 +58,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
* @access private * @access private
* @var string * @var string
*/ */
private $_delimiter; private $_delimiter = ',';
/** /**
* Enclosure * Enclosure
@ -66,7 +66,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
* @access private * @access private
* @var string * @var string
*/ */
private $_enclosure; private $_enclosure = '"';
/** /**
* Line ending * Line ending
@ -74,7 +74,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
* @access private * @access private
* @var string * @var string
*/ */
private $_lineEnding; private $_lineEnding = PHP_EOL;
/** /**
* Sheet index to read * Sheet index to read
@ -82,7 +82,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
* @access private * @access private
* @var int * @var int
*/ */
private $_sheetIndex; private $_sheetIndex = 0;
/** /**
* Load rows contiguously * Load rows contiguously
@ -90,7 +90,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
* @access private * @access private
* @var int * @var int
*/ */
private $_contiguous; private $_contiguous = false;
/** /**
@ -99,7 +99,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
* @access private * @access private
* @var int * @var int
*/ */
private $_contiguousRow; private $_contiguousRow = -1;
/** /**
* PHPExcel_Reader_IReadFilter instance * PHPExcel_Reader_IReadFilter instance
@ -113,14 +113,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
* Create a new PHPExcel_Reader_CSV * Create a new PHPExcel_Reader_CSV
*/ */
public function __construct() { 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->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
$this->_contiguous = false;
$this->_contiguousRow = -1;
} // function __construct() } // function __construct()
/** /**
@ -236,6 +229,22 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
fgets($fileHandle, 4) == "\xEF\xBB\xBF" ? fgets($fileHandle, 4) == "\xEF\xBB\xBF" ?
fseek($fileHandle, 3) : fseek($fileHandle, 0); fseek($fileHandle, 3) : fseek($fileHandle, 0);
break; 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: default:
break; break;
} }
@ -244,42 +253,40 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
$this->_enclosure . $this->_enclosure $this->_enclosure . $this->_enclosure
); );
// Loop through file // Set our starting row based on whether we're in contiguous mode or not
$currentRow = 0; $currentRow = 1;
if ($this->_contiguousRow == -1) { if ($this->_contiguous) {
$this->_contiguousRow = $objPHPExcel->getActiveSheet()->getHighestRow(); $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) { while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) {
++$currentRow;
$rowDataCount = count($rowData);
$columnLetter = 'A'; $columnLetter = 'A';
for ($i = 0; $i < $rowDataCount; ++$i) { foreach($rowData as $rowDatum) {
if ($rowData[$i] != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) { if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) {
// Unescape enclosures // Unescape enclosures
$rowData[$i] = str_replace($escapeEnclosures, $this->_enclosure, $rowData[$i]); $rowDatum = str_replace($escapeEnclosures, $this->_enclosure, $rowDatum);
// Convert encoding if necessary // Convert encoding if necessary
if ($this->_inputEncoding !== 'UTF-8') { 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
// Set cell value $objPHPExcel->getActiveSheet()->getCell($columnLetter . $currentRow)->setValue($rowDatum);
$objPHPExcel->getActiveSheet()->getCell($columnLetter . $this->_contiguousRow)->setValue($rowData[$i]);
} else {
// Set cell value
$objPHPExcel->getActiveSheet()->getCell($columnLetter . $currentRow)->setValue($rowData[$i]);
}
} }
++$columnLetter; ++$columnLetter;
} }
++$this->_contiguousRow; ++$currentRow;
} }
// Close file // Close file
fclose($fileHandle); fclose($fileHandle);
if ($this->_contiguous) {
$this->_contiguousRow = $currentRow;
}
// Return // Return
return $objPHPExcel; return $objPHPExcel;
} // function loadIntoExisting() } // function loadIntoExisting()

View File

@ -63,7 +63,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
* *
* @var int * @var int
*/ */
private $_sheetIndex; private $_sheetIndex = 0;
/** /**
* Formats * Formats
@ -158,7 +158,6 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
* Create a new PHPExcel_Reader_Excel2003XML * Create a new PHPExcel_Reader_Excel2003XML
*/ */
public function __construct() { public function __construct() {
$this->_sheetIndex = 0;
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
} }

View File

@ -431,7 +431,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
// add style to cellXf collection // add style to cellXf collection
$objStyle = new PHPExcel_Style; $objStyle = new PHPExcel_Style;
$this->_readStyle($objStyle, $style); self::_readStyle($objStyle, $style);
$excel->addCellXf($objStyle); $excel->addCellXf($objStyle);
} }
@ -458,7 +458,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
// add style to cellStyleXf collection // add style to cellStyleXf collection
$objStyle = new PHPExcel_Style; $objStyle = new PHPExcel_Style;
$this->_readStyle($objStyle, $cellStyle); self::_readStyle($objStyle, $cellStyle);
$excel->addCellStyleXf($objStyle); $excel->addCellStyleXf($objStyle);
} }
} }
@ -468,7 +468,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
if ($xmlStyles->dxfs) { if ($xmlStyles->dxfs) {
foreach ($xmlStyles->dxfs->dxf as $dxf) { foreach ($xmlStyles->dxfs->dxf as $dxf) {
$style = new PHPExcel_Style; $style = new PHPExcel_Style;
$this->_readStyle($style, $dxf); self::_readStyle($style, $dxf);
$dxfs[] = $style; $dxfs[] = $style;
} }
} }
@ -480,7 +480,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
if (isset($cellStyles[intval($cellStyle['xfId'])])) { if (isset($cellStyles[intval($cellStyle['xfId'])])) {
// Set default style // Set default style
$style = new PHPExcel_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 // 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 // format code
if (isset($style->numFmt)) { if (isset($style->numFmt)) {
$docStyle->getNumberFormat()->setFormatCode($style->numFmt); $docStyle->getNumberFormat()->setFormatCode($style->numFmt);

View File

@ -63,7 +63,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
* *
* @var int * @var int
*/ */
private $_sheetIndex; private $_sheetIndex = 0;
/** /**
* Formats * Formats
@ -167,7 +167,6 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
* Create a new PHPExcel_Reader_Gnumeric * Create a new PHPExcel_Reader_Gnumeric
*/ */
public function __construct() { public function __construct() {
$this->_sheetIndex = 0;
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
$this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance(); $this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance();
} }

View File

@ -63,7 +63,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
* *
* @var int * @var int
*/ */
private $_sheetIndex; private $_sheetIndex = 0;
/** /**
* Formats * Formats
@ -158,7 +158,6 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
* Create a new PHPExcel_Reader_OOCalc * Create a new PHPExcel_Reader_OOCalc
*/ */
public function __construct() { public function __construct() {
$this->_sheetIndex = 0;
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
} }

View File

@ -49,14 +49,14 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
* *
* @var string * @var string
*/ */
private $_inputEncoding; private $_inputEncoding = 'ANSI';
/** /**
* Sheet index to read * Sheet index to read
* *
* @var int * @var int
*/ */
private $_sheetIndex; private $_sheetIndex = 0;
/** /**
* Formats * Formats
@ -83,8 +83,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
* Create a new PHPExcel_Reader_SYLK * Create a new PHPExcel_Reader_SYLK
*/ */
public function __construct() { public function __construct() {
$this->_inputEncoding = 'ANSI';
$this->_sheetIndex = 0;
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
} }

View File

@ -19,10 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Style * @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
@ -30,7 +30,7 @@
* PHPExcel_Style_Alignment * PHPExcel_Style_Alignment
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Style * @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
*/ */
class PHPExcel_Style_Alignment implements PHPExcel_IComparable class PHPExcel_Style_Alignment implements PHPExcel_IComparable
@ -54,42 +54,42 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
* *
* @var string * @var string
*/ */
private $_horizontal; private $_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
/** /**
* Vertical * Vertical
* *
* @var string * @var string
*/ */
private $_vertical; private $_vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
/** /**
* Text rotation * Text rotation
* *
* @var int * @var int
*/ */
private $_textRotation; private $_textRotation = 0;
/** /**
* Wrap text * Wrap text
* *
* @var boolean * @var boolean
*/ */
private $_wrapText; private $_wrapText = false;
/** /**
* Shrink to fit * Shrink to fit
* *
* @var boolean * @var boolean
*/ */
private $_shrinkToFit; private $_shrinkToFit = false;
/** /**
* Indent - only possible with horizontal alignment left and right * Indent - only possible with horizontal alignment left and right
* *
* @var int * @var int
*/ */
private $_indent; private $_indent = 0;
/** /**
* Parent Borders * Parent Borders
@ -112,22 +112,14 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
*/ */
private $_parent; private $_parent;
/** /**
* Create a new PHPExcel_Style_Alignment * Create a new PHPExcel_Style_Alignment
*/ */
public function __construct($isSupervisor = false) public function __construct($isSupervisor = false)
{ {
// Supervisor? // Supervisor?
$this->_isSupervisor = $isSupervisor; $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 * Bind parent. Only used for supervisor
@ -205,24 +197,24 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
return array('alignment' => $array); return array('alignment' => $array);
} }
/** /**
* Apply styles from array * Apply styles from array
* *
* <code> * <code>
* $objPHPExcel->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray( * $objPHPExcel->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray(
* array( * array(
* 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, * 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
* 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER, * 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER,
* 'rotation' => 0, * 'rotation' => 0,
* 'wrap' => true * 'wrap' => true
* ) * )
* ); * );
* </code> * </code>
* *
* @param array $pStyles Array containing style information * @param array $pStyles Array containing style information
* @throws Exception * @throws Exception
* @return PHPExcel_Style_Alignment * @return PHPExcel_Style_Alignment
*/ */
public function applyFromArray($pStyles = null) { public function applyFromArray($pStyles = null) {
if (is_array($pStyles)) { if (is_array($pStyles)) {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
@ -253,28 +245,28 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
return $this; return $this;
} }
/** /**
* Get Horizontal * Get Horizontal
* *
* @return string * @return string
*/ */
public function getHorizontal() { public function getHorizontal() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHorizontal(); return $this->getSharedComponent()->getHorizontal();
} }
return $this->_horizontal; return $this->_horizontal;
} }
/** /**
* Set Horizontal * Set Horizontal
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Style_Alignment * @return PHPExcel_Style_Alignment
*/ */
public function setHorizontal($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) { public function setHorizontal($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) {
if ($pValue == '') { if ($pValue == '') {
$pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; $pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
} }
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('horizontal' => $pValue)); $styleArray = $this->getStyleArray(array('horizontal' => $pValue));
@ -284,30 +276,30 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
$this->_horizontal = $pValue; $this->_horizontal = $pValue;
} }
return $this; return $this;
} }
/** /**
* Get Vertical * Get Vertical
* *
* @return string * @return string
*/ */
public function getVertical() { public function getVertical() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getVertical(); return $this->getSharedComponent()->getVertical();
} }
return $this->_vertical; return $this->_vertical;
} }
/** /**
* Set Vertical * Set Vertical
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Style_Alignment * @return PHPExcel_Style_Alignment
*/ */
public function setVertical($pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM) { public function setVertical($pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM) {
if ($pValue == '') { if ($pValue == '') {
$pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; $pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
} }
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('vertical' => $pValue)); $styleArray = $this->getStyleArray(array('vertical' => $pValue));
@ -316,70 +308,70 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
$this->_vertical = $pValue; $this->_vertical = $pValue;
} }
return $this; return $this;
} }
/** /**
* Get TextRotation * Get TextRotation
* *
* @return int * @return int
*/ */
public function getTextRotation() { public function getTextRotation() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getTextRotation(); return $this->getSharedComponent()->getTextRotation();
} }
return $this->_textRotation; return $this->_textRotation;
} }
/** /**
* Set TextRotation * Set TextRotation
* *
* @param int $pValue * @param int $pValue
* @throws Exception * @throws Exception
* @return PHPExcel_Style_Alignment * @return PHPExcel_Style_Alignment
*/ */
public function setTextRotation($pValue = 0) { public function setTextRotation($pValue = 0) {
// Excel2007 value 255 => PHPExcel value -165 // Excel2007 value 255 => PHPExcel value -165
if ($pValue == 255) { if ($pValue == 255) {
$pValue = -165; $pValue = -165;
} }
// Set rotation // Set rotation
if ( ($pValue >= -90 && $pValue <= 90) || $pValue == -165 ) { if ( ($pValue >= -90 && $pValue <= 90) || $pValue == -165 ) {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('rotation' => $pValue)); $styleArray = $this->getStyleArray(array('rotation' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else { } else {
$this->_textRotation = $pValue; $this->_textRotation = $pValue;
} }
} else { } else {
throw new Exception("Text rotation should be a value between -90 and 90."); throw new Exception("Text rotation should be a value between -90 and 90.");
} }
return $this; return $this;
} }
/** /**
* Get Wrap Text * Get Wrap Text
* *
* @return boolean * @return boolean
*/ */
public function getWrapText() { public function getWrapText() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getWrapText(); return $this->getSharedComponent()->getWrapText();
} }
return $this->_wrapText; return $this->_wrapText;
} }
/** /**
* Set Wrap Text * Set Wrap Text
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Style_Alignment * @return PHPExcel_Style_Alignment
*/ */
public function setWrapText($pValue = false) { public function setWrapText($pValue = false) {
if ($pValue == '') { if ($pValue == '') {
$pValue = false; $pValue = false;
} }
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('wrap' => $pValue)); $styleArray = $this->getStyleArray(array('wrap' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
@ -387,30 +379,30 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
$this->_wrapText = $pValue; $this->_wrapText = $pValue;
} }
return $this; return $this;
} }
/** /**
* Get Shrink to fit * Get Shrink to fit
* *
* @return boolean * @return boolean
*/ */
public function getShrinkToFit() { public function getShrinkToFit() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getShrinkToFit(); return $this->getSharedComponent()->getShrinkToFit();
} }
return $this->_shrinkToFit; return $this->_shrinkToFit;
} }
/** /**
* Set Shrink to fit * Set Shrink to fit
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Style_Alignment * @return PHPExcel_Style_Alignment
*/ */
public function setShrinkToFit($pValue = false) { public function setShrinkToFit($pValue = false) {
if ($pValue == '') { if ($pValue == '') {
$pValue = false; $pValue = false;
} }
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('shrinkToFit' => $pValue)); $styleArray = $this->getStyleArray(array('shrinkToFit' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
@ -418,27 +410,27 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
$this->_shrinkToFit = $pValue; $this->_shrinkToFit = $pValue;
} }
return $this; return $this;
} }
/** /**
* Get indent * Get indent
* *
* @return int * @return int
*/ */
public function getIndent() { public function getIndent() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getIndent(); return $this->getSharedComponent()->getIndent();
} }
return $this->_indent; return $this->_indent;
} }
/** /**
* Set indent * Set indent
* *
* @param int $pValue * @param int $pValue
* @return PHPExcel_Style_Alignment * @return PHPExcel_Style_Alignment
*/ */
public function setIndent($pValue = 0) { public function setIndent($pValue = 0) {
if ($pValue > 0) { if ($pValue > 0) {
if ($this->getHorizontal() != self::HORIZONTAL_GENERAL && $this->getHorizontal() != self::HORIZONTAL_LEFT && $this->getHorizontal() != self::HORIZONTAL_RIGHT) { if ($this->getHorizontal() != self::HORIZONTAL_GENERAL && $this->getHorizontal() != self::HORIZONTAL_LEFT && $this->getHorizontal() != self::HORIZONTAL_RIGHT) {
$pValue = 0; // indent not supported $pValue = 0; // indent not supported
@ -451,7 +443,7 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
$this->_indent = $pValue; $this->_indent = $pValue;
} }
return $this; return $this;
} }
/** /**
* Get hash code * Get hash code
@ -462,16 +454,16 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHashCode(); return $this->getSharedComponent()->getHashCode();
} }
return md5( return md5(
$this->_horizontal $this->_horizontal
. $this->_vertical . $this->_vertical
. $this->_textRotation . $this->_textRotation
. ($this->_wrapText ? 't' : 'f') . ($this->_wrapText ? 't' : 'f')
. ($this->_shrinkToFit ? 't' : 'f') . ($this->_shrinkToFit ? 't' : 'f')
. $this->_indent . $this->_indent
. __CLASS__ . __CLASS__
); );
} }
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.

View File

@ -19,10 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Style * @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
@ -30,7 +30,7 @@
* PHPExcel_Style_Border * PHPExcel_Style_Border
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Style * @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
*/ */
class PHPExcel_Style_Border implements PHPExcel_IComparable class PHPExcel_Style_Border implements PHPExcel_IComparable
@ -56,7 +56,7 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
* *
* @var string * @var string
*/ */
private $_borderStyle; private $_borderStyle = PHPExcel_Style_Border::BORDER_NONE;
/** /**
* Border color * Border color
@ -86,23 +86,22 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
*/ */
private $_parentPropertyName; private $_parentPropertyName;
/** /**
* Create a new PHPExcel_Style_Border * Create a new PHPExcel_Style_Border
*/ */
public function __construct($isSupervisor = false) public function __construct($isSupervisor = false)
{ {
// Supervisor? // Supervisor?
$this->_isSupervisor = $isSupervisor; $this->_isSupervisor = $isSupervisor;
// Initialise values // Initialise values
$this->_borderStyle = PHPExcel_Style_Border::BORDER_NONE;
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
// bind parent if we are a supervisor // bind parent if we are a supervisor
if ($isSupervisor) { if ($isSupervisor) {
$this->_color->bindParent($this, '_color'); $this->_color->bindParent($this, '_color');
} }
} }
/** /**
* Bind parent. Only used for supervisor * Bind parent. Only used for supervisor
@ -253,24 +252,24 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
return $this->_parent->getStyleArray(array($key => $array)); return $this->_parent->getStyleArray(array($key => $array));
} }
/** /**
* Apply styles from array * Apply styles from array
* *
* <code> * <code>
* $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray( * $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray(
* array( * array(
* 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
* 'color' => array( * 'color' => array(
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * )
* ) * )
* ); * );
* </code> * </code>
* *
* @param array $pStyles Array containing style information * @param array $pStyles Array containing style information
* @throws Exception * @throws Exception
* @return PHPExcel_Style_Border * @return PHPExcel_Style_Border
*/ */
public function applyFromArray($pStyles = null) { public function applyFromArray($pStyles = null) {
if (is_array($pStyles)) { if (is_array($pStyles)) {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
@ -289,29 +288,29 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
return $this; return $this;
} }
/** /**
* Get Border style * Get Border style
* *
* @return string * @return string
*/ */
public function getBorderStyle() { public function getBorderStyle() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getBorderStyle(); return $this->getSharedComponent()->getBorderStyle();
} }
return $this->_borderStyle; return $this->_borderStyle;
} }
/** /**
* Set Border style * Set Border style
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Style_Border * @return PHPExcel_Style_Border
*/ */
public function setBorderStyle($pValue = PHPExcel_Style_Border::BORDER_NONE) { public function setBorderStyle($pValue = PHPExcel_Style_Border::BORDER_NONE) {
if ($pValue == '') { if ($pValue == '') {
$pValue = PHPExcel_Style_Border::BORDER_NONE; $pValue = PHPExcel_Style_Border::BORDER_NONE;
} }
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('style' => $pValue)); $styleArray = $this->getStyleArray(array('style' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
@ -319,25 +318,25 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
$this->_borderStyle = $pValue; $this->_borderStyle = $pValue;
} }
return $this; return $this;
} }
/** /**
* Get Border Color * Get Border Color
* *
* @return PHPExcel_Style_Color * @return PHPExcel_Style_Color
*/ */
public function getColor() { public function getColor() {
return $this->_color; return $this->_color;
} }
/** /**
* Set Border Color * Set Border Color
* *
* @param PHPExcel_Style_Color $pValue * @param PHPExcel_Style_Color $pValue
* @throws Exception * @throws Exception
* @return PHPExcel_Style_Border * @return PHPExcel_Style_Border
*/ */
public function setColor(PHPExcel_Style_Color $pValue = null) { public function setColor(PHPExcel_Style_Color $pValue = null) {
// make sure parameter is a real color and not a supervisor // make sure parameter is a real color and not a supervisor
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
@ -348,7 +347,7 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
$this->_color = $color; $this->_color = $color;
} }
return $this; return $this;
} }
/** /**
* Get hash code * Get hash code
@ -359,12 +358,12 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHashCode(); return $this->getSharedComponent()->getHashCode();
} }
return md5( return md5(
$this->_borderStyle $this->_borderStyle
. $this->_color->getHashCode() . $this->_color->getHashCode()
. __CLASS__ . __CLASS__
); );
} }
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.

View File

@ -19,10 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Style * @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
@ -30,7 +30,7 @@
* PHPExcel_Style_Fill * PHPExcel_Style_Fill
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Style * @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
*/ */
class PHPExcel_Style_Fill implements PHPExcel_IComparable class PHPExcel_Style_Fill implements PHPExcel_IComparable
@ -63,14 +63,14 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
* *
* @var string * @var string
*/ */
private $_fillType; private $_fillType = PHPExcel_Style_Fill::FILL_NONE;
/** /**
* Rotation * Rotation
* *
* @var double * @var double
*/ */
private $_rotation; private $_rotation = 0;
/** /**
* Start color * Start color
@ -107,17 +107,15 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
*/ */
private $_parent; private $_parent;
/** /**
* Create a new PHPExcel_Style_Fill * Create a new PHPExcel_Style_Fill
*/ */
public function __construct($isSupervisor = false) public function __construct($isSupervisor = false)
{ {
// Supervisor? // Supervisor?
$this->_isSupervisor = $isSupervisor; $this->_isSupervisor = $isSupervisor;
// Initialise values // Initialise values
$this->_fillType = PHPExcel_Style_Fill::FILL_NONE;
$this->_rotation = 0;
$this->_startColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_WHITE, $isSupervisor); $this->_startColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_WHITE, $isSupervisor);
$this->_endColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $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->_startColor->bindParent($this, '_startColor');
$this->_endColor->bindParent($this, '_endColor'); $this->_endColor->bindParent($this, '_endColor');
} }
} }
/** /**
* Bind parent. Only used for supervisor * Bind parent. Only used for supervisor
@ -204,28 +202,28 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
return array('fill' => $array); return array('fill' => $array);
} }
/** /**
* Apply styles from array * Apply styles from array
* *
* <code> * <code>
* $objPHPExcel->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray( * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray(
* array( * array(
* 'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, * 'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR,
* 'rotation' => 0, * 'rotation' => 0,
* 'startcolor' => array( * 'startcolor' => array(
* 'rgb' => '000000' * 'rgb' => '000000'
* ), * ),
* 'endcolor' => array( * 'endcolor' => array(
* 'argb' => 'FFFFFFFF' * 'argb' => 'FFFFFFFF'
* ) * )
* ) * )
* ); * );
* </code> * </code>
* *
* @param array $pStyles Array containing style information * @param array $pStyles Array containing style information
* @throws Exception * @throws Exception
* @return PHPExcel_Style_Fill * @return PHPExcel_Style_Fill
*/ */
public function applyFromArray($pStyles = null) { public function applyFromArray($pStyles = null) {
if (is_array($pStyles)) { if (is_array($pStyles)) {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
@ -253,25 +251,25 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
return $this; return $this;
} }
/** /**
* Get Fill Type * Get Fill Type
* *
* @return string * @return string
*/ */
public function getFillType() { public function getFillType() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getFillType(); return $this->getSharedComponent()->getFillType();
} }
return $this->_fillType; return $this->_fillType;
} }
/** /**
* Set Fill Type * Set Fill Type
* *
* @param string $pValue PHPExcel_Style_Fill fill type * @param string $pValue PHPExcel_Style_Fill fill type
* @return PHPExcel_Style_Fill * @return PHPExcel_Style_Fill
*/ */
public function setFillType($pValue = PHPExcel_Style_Fill::FILL_NONE) { public function setFillType($pValue = PHPExcel_Style_Fill::FILL_NONE) {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('type' => $pValue)); $styleArray = $this->getStyleArray(array('type' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
@ -279,27 +277,27 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
$this->_fillType = $pValue; $this->_fillType = $pValue;
} }
return $this; return $this;
} }
/** /**
* Get Rotation * Get Rotation
* *
* @return double * @return double
*/ */
public function getRotation() { public function getRotation() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getRotation(); return $this->getSharedComponent()->getRotation();
} }
return $this->_rotation; return $this->_rotation;
} }
/** /**
* Set Rotation * Set Rotation
* *
* @param double $pValue * @param double $pValue
* @return PHPExcel_Style_Fill * @return PHPExcel_Style_Fill
*/ */
public function setRotation($pValue = 0) { public function setRotation($pValue = 0) {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('rotation' => $pValue)); $styleArray = $this->getStyleArray(array('rotation' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
@ -307,25 +305,25 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
$this->_rotation = $pValue; $this->_rotation = $pValue;
} }
return $this; return $this;
} }
/** /**
* Get Start Color * Get Start Color
* *
* @return PHPExcel_Style_Color * @return PHPExcel_Style_Color
*/ */
public function getStartColor() { public function getStartColor() {
return $this->_startColor; return $this->_startColor;
} }
/** /**
* Set Start Color * Set Start Color
* *
* @param PHPExcel_Style_Color $pValue * @param PHPExcel_Style_Color $pValue
* @throws Exception * @throws Exception
* @return PHPExcel_Style_Fill * @return PHPExcel_Style_Fill
*/ */
public function setStartColor(PHPExcel_Style_Color $pValue = null) { public function setStartColor(PHPExcel_Style_Color $pValue = null) {
// make sure parameter is a real color and not a supervisor // make sure parameter is a real color and not a supervisor
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
@ -336,25 +334,25 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
$this->_startColor = $color; $this->_startColor = $color;
} }
return $this; return $this;
} }
/** /**
* Get End Color * Get End Color
* *
* @return PHPExcel_Style_Color * @return PHPExcel_Style_Color
*/ */
public function getEndColor() { public function getEndColor() {
return $this->_endColor; return $this->_endColor;
} }
/** /**
* Set End Color * Set End Color
* *
* @param PHPExcel_Style_Color $pValue * @param PHPExcel_Style_Color $pValue
* @throws Exception * @throws Exception
* @return PHPExcel_Style_Fill * @return PHPExcel_Style_Fill
*/ */
public function setEndColor(PHPExcel_Style_Color $pValue = null) { public function setEndColor(PHPExcel_Style_Color $pValue = null) {
// make sure parameter is a real color and not a supervisor // make sure parameter is a real color and not a supervisor
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
@ -365,7 +363,7 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
$this->_endColor = $color; $this->_endColor = $color;
} }
return $this; return $this;
} }
/** /**
* Get hash code * Get hash code
@ -376,14 +374,14 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHashCode(); return $this->getSharedComponent()->getHashCode();
} }
return md5( return md5(
$this->getFillType() $this->getFillType()
. $this->getRotation() . $this->getRotation()
. $this->getStartColor()->getHashCode() . $this->getStartColor()->getHashCode()
. $this->getEndColor()->getHashCode() . $this->getEndColor()->getHashCode()
. __CLASS__ . __CLASS__
); );
} }
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.

View File

@ -19,10 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Style * @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
@ -30,7 +30,7 @@
* PHPExcel_Style_Font * PHPExcel_Style_Font
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Style * @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
*/ */
class PHPExcel_Style_Font implements PHPExcel_IComparable class PHPExcel_Style_Font implements PHPExcel_IComparable
@ -43,53 +43,60 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
const UNDERLINE_SINGLEACCOUNTING = 'singleAccounting'; const UNDERLINE_SINGLEACCOUNTING = 'singleAccounting';
/** /**
* Name * Font Name
* *
* @var string * @var string
*/ */
private $_name; private $_name = 'Calibri';
/**
* Font Size
*
* @var float
*/
private $_size = 11;
/** /**
* Bold * Bold
* *
* @var boolean * @var boolean
*/ */
private $_bold; private $_bold = false;
/** /**
* Italic * Italic
* *
* @var boolean * @var boolean
*/ */
private $_italic; private $_italic = false;
/** /**
* Superscript * Superscript
* *
* @var boolean * @var boolean
*/ */
private $_superScript; private $_superScript = false;
/** /**
* Subscript * Subscript
* *
* @var boolean * @var boolean
*/ */
private $_subScript; private $_subScript = false;
/** /**
* Underline * Underline
* *
* @var string * @var string
*/ */
private $_underline; private $_underline = PHPExcel_Style_Font::UNDERLINE_NONE;
/** /**
* Strikethrough * Strikethrough
* *
* @var boolean * @var boolean
*/ */
private $_strikethrough; private $_strikethrough = false;
/** /**
* Foreground color * Foreground color
@ -120,29 +127,21 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
private $_parent; private $_parent;
/** /**
* Create a new PHPExcel_Style_Font * Create a new PHPExcel_Style_Font
*/ */
public function __construct($isSupervisor = false) public function __construct($isSupervisor = false)
{ {
// Supervisor? // Supervisor?
$this->_isSupervisor = $isSupervisor; $this->_isSupervisor = $isSupervisor;
// Initialise values // 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;
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
// bind parent if we are a supervisor // bind parent if we are a supervisor
if ($isSupervisor) { if ($isSupervisor) {
$this->_color->bindParent($this, '_color'); $this->_color->bindParent($this, '_color');
} }
} }
/** /**
* Bind parent. Only used for supervisor * Bind parent. Only used for supervisor
@ -219,28 +218,28 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
return array('font' => $array); return array('font' => $array);
} }
/** /**
* Apply styles from array * Apply styles from array
* *
* <code> * <code>
* $objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray( * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray(
* array( * array(
* 'name' => 'Arial', * 'name' => 'Arial',
* 'bold' => true, * 'bold' => true,
* 'italic' => false, * 'italic' => false,
* 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE, * 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE,
* 'strike' => false, * 'strike' => false,
* 'color' => array( * 'color' => array(
* 'rgb' => '808080' * 'rgb' => '808080'
* ) * )
* ) * )
* ); * );
* </code> * </code>
* *
* @param array $pStyles Array containing style information * @param array $pStyles Array containing style information
* @throws Exception * @throws Exception
* @return PHPExcel_Style_Font * @return PHPExcel_Style_Font
*/ */
public function applyFromArray($pStyles = null) { public function applyFromArray($pStyles = null) {
if (is_array($pStyles)) { if (is_array($pStyles)) {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
@ -280,28 +279,28 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
return $this; return $this;
} }
/** /**
* Get Name * Get Name
* *
* @return string * @return string
*/ */
public function getName() { public function getName() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getName(); return $this->getSharedComponent()->getName();
} }
return $this->_name; return $this->_name;
} }
/** /**
* Set Name * Set Name
* *
* @param string $pValue * @param string $pValue
* @return PHPExcel_Style_Font * @return PHPExcel_Style_Font
*/ */
public function setName($pValue = 'Calibri') { public function setName($pValue = 'Calibri') {
if ($pValue == '') { if ($pValue == '') {
$pValue = 'Calibri'; $pValue = 'Calibri';
} }
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('name' => $pValue)); $styleArray = $this->getStyleArray(array('name' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
@ -309,30 +308,30 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
$this->_name = $pValue; $this->_name = $pValue;
} }
return $this; return $this;
} }
/** /**
* Get Size * Get Size
* *
* @return double * @return double
*/ */
public function getSize() { public function getSize() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getSize(); return $this->getSharedComponent()->getSize();
} }
return $this->_size; return $this->_size;
} }
/** /**
* Set Size * Set Size
* *
* @param double $pValue * @param double $pValue
* @return PHPExcel_Style_Font * @return PHPExcel_Style_Font
*/ */
public function setSize($pValue = 10) { public function setSize($pValue = 10) {
if ($pValue == '') { if ($pValue == '') {
$pValue = 10; $pValue = 10;
} }
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('size' => $pValue)); $styleArray = $this->getStyleArray(array('size' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
@ -340,30 +339,30 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
$this->_size = $pValue; $this->_size = $pValue;
} }
return $this; return $this;
} }
/** /**
* Get Bold * Get Bold
* *
* @return boolean * @return boolean
*/ */
public function getBold() { public function getBold() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getBold(); return $this->getSharedComponent()->getBold();
} }
return $this->_bold; return $this->_bold;
} }
/** /**
* Set Bold * Set Bold
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Style_Font * @return PHPExcel_Style_Font
*/ */
public function setBold($pValue = false) { public function setBold($pValue = false) {
if ($pValue == '') { if ($pValue == '') {
$pValue = false; $pValue = false;
} }
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('bold' => $pValue)); $styleArray = $this->getStyleArray(array('bold' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
@ -371,30 +370,30 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
$this->_bold = $pValue; $this->_bold = $pValue;
} }
return $this; return $this;
} }
/** /**
* Get Italic * Get Italic
* *
* @return boolean * @return boolean
*/ */
public function getItalic() { public function getItalic() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getItalic(); return $this->getSharedComponent()->getItalic();
} }
return $this->_italic; return $this->_italic;
} }
/** /**
* Set Italic * Set Italic
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Style_Font * @return PHPExcel_Style_Font
*/ */
public function setItalic($pValue = false) { public function setItalic($pValue = false) {
if ($pValue == '') { if ($pValue == '') {
$pValue = false; $pValue = false;
} }
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('italic' => $pValue)); $styleArray = $this->getStyleArray(array('italic' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
@ -402,30 +401,30 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
$this->_italic = $pValue; $this->_italic = $pValue;
} }
return $this; return $this;
} }
/** /**
* Get SuperScript * Get SuperScript
* *
* @return boolean * @return boolean
*/ */
public function getSuperScript() { public function getSuperScript() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getSuperScript(); return $this->getSharedComponent()->getSuperScript();
} }
return $this->_superScript; return $this->_superScript;
} }
/** /**
* Set SuperScript * Set SuperScript
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Style_Font * @return PHPExcel_Style_Font
*/ */
public function setSuperScript($pValue = false) { public function setSuperScript($pValue = false) {
if ($pValue == '') { if ($pValue == '') {
$pValue = false; $pValue = false;
} }
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('superScript' => $pValue)); $styleArray = $this->getStyleArray(array('superScript' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
@ -434,30 +433,30 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
$this->_subScript = !$pValue; $this->_subScript = !$pValue;
} }
return $this; return $this;
} }
/** /**
* Get SubScript * Get SubScript
* *
* @return boolean * @return boolean
*/ */
public function getSubScript() { public function getSubScript() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getSubScript(); return $this->getSharedComponent()->getSubScript();
} }
return $this->_subScript; return $this->_subScript;
} }
/** /**
* Set SubScript * Set SubScript
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Style_Font * @return PHPExcel_Style_Font
*/ */
public function setSubScript($pValue = false) { public function setSubScript($pValue = false) {
if ($pValue == '') { if ($pValue == '') {
$pValue = false; $pValue = false;
} }
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('subScript' => $pValue)); $styleArray = $this->getStyleArray(array('subScript' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
@ -466,30 +465,30 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
$this->_superScript = !$pValue; $this->_superScript = !$pValue;
} }
return $this; return $this;
} }
/** /**
* Get Underline * Get Underline
* *
* @return string * @return string
*/ */
public function getUnderline() { public function getUnderline() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getUnderline(); return $this->getSharedComponent()->getUnderline();
} }
return $this->_underline; return $this->_underline;
} }
/** /**
* Set Underline * Set Underline
* *
* @param string $pValue PHPExcel_Style_Font underline type * @param string $pValue PHPExcel_Style_Font underline type
* @return PHPExcel_Style_Font * @return PHPExcel_Style_Font
*/ */
public function setUnderline($pValue = PHPExcel_Style_Font::UNDERLINE_NONE) { public function setUnderline($pValue = PHPExcel_Style_Font::UNDERLINE_NONE) {
if ($pValue == '') { if ($pValue == '') {
$pValue = PHPExcel_Style_Font::UNDERLINE_NONE; $pValue = PHPExcel_Style_Font::UNDERLINE_NONE;
} }
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('underline' => $pValue)); $styleArray = $this->getStyleArray(array('underline' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
@ -497,51 +496,51 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
$this->_underline = $pValue; $this->_underline = $pValue;
} }
return $this; return $this;
} }
/** /**
* Get Striketrough * Get Striketrough
* *
* @deprecated Use getStrikethrough() instead. * @deprecated Use getStrikethrough() instead.
* @return boolean * @return boolean
*/ */
public function getStriketrough() { public function getStriketrough() {
return $this->getStrikethrough(); return $this->getStrikethrough();
} }
/** /**
* Set Striketrough * Set Striketrough
* *
* @deprecated Use setStrikethrough() instead. * @deprecated Use setStrikethrough() instead.
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Style_Font * @return PHPExcel_Style_Font
*/ */
public function setStriketrough($pValue = false) { public function setStriketrough($pValue = false) {
return $this->setStrikethrough($pValue); return $this->setStrikethrough($pValue);
} }
/** /**
* Get Strikethrough * Get Strikethrough
* *
* @return boolean * @return boolean
*/ */
public function getStrikethrough() { public function getStrikethrough() {
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getStrikethrough(); return $this->getSharedComponent()->getStrikethrough();
} }
return $this->_strikethrough; return $this->_strikethrough;
} }
/** /**
* Set Strikethrough * Set Strikethrough
* *
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Style_Font * @return PHPExcel_Style_Font
*/ */
public function setStrikethrough($pValue = false) { public function setStrikethrough($pValue = false) {
if ($pValue == '') { if ($pValue == '') {
$pValue = false; $pValue = false;
} }
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('strike' => $pValue)); $styleArray = $this->getStyleArray(array('strike' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
@ -549,25 +548,25 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
$this->_strikethrough = $pValue; $this->_strikethrough = $pValue;
} }
return $this; return $this;
} }
/** /**
* Get Color * Get Color
* *
* @return PHPExcel_Style_Color * @return PHPExcel_Style_Color
*/ */
public function getColor() { public function getColor() {
return $this->_color; return $this->_color;
} }
/** /**
* Set Color * Set Color
* *
* @param PHPExcel_Style_Color $pValue * @param PHPExcel_Style_Color $pValue
* @throws Exception * @throws Exception
* @return PHPExcel_Style_Font * @return PHPExcel_Style_Font
*/ */
public function setColor(PHPExcel_Style_Color $pValue = null) { public function setColor(PHPExcel_Style_Color $pValue = null) {
// make sure parameter is a real color and not a supervisor // make sure parameter is a real color and not a supervisor
$color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
@ -578,7 +577,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
$this->_color = $color; $this->_color = $color;
} }
return $this; return $this;
} }
/** /**
* Get hash code * Get hash code
@ -589,19 +588,19 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
if ($this->_isSupervisor) { if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHashCode(); return $this->getSharedComponent()->getHashCode();
} }
return md5( return md5(
$this->_name $this->_name
. $this->_size . $this->_size
. ($this->_bold ? 't' : 'f') . ($this->_bold ? 't' : 'f')
. ($this->_italic ? 't' : 'f') . ($this->_italic ? 't' : 'f')
. ($this->_superScript ? 't' : 'f') . ($this->_superScript ? 't' : 'f')
. ($this->_subScript ? 't' : 'f') . ($this->_subScript ? 't' : 'f')
. $this->_underline . $this->_underline
. ($this->_strikethrough ? 't' : 'f') . ($this->_strikethrough ? 't' : 'f')
. $this->_color->getHashCode() . $this->_color->getHashCode()
. __CLASS__ . __CLASS__
); );
} }
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.

View File

@ -19,10 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Style * @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
@ -30,7 +30,7 @@
* PHPExcel_Style_NumberFormat * PHPExcel_Style_NumberFormat
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Style * @package PHPExcel_Style
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
*/ */
class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
@ -94,14 +94,14 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
* *
* @var string * @var string
*/ */
private $_formatCode; private $_formatCode = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
/** /**
* Built-in format Code * Built-in format Code
* *
* @var string * @var string
*/ */
private $_builtInFormatCode; private $_builtInFormatCode = 0;
/** /**
* Parent Borders * Parent Borders
@ -131,10 +131,6 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
{ {
// Supervisor? // Supervisor?
$this->_isSupervisor = $isSupervisor; $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
* *
* <code> * <code>
* $objPHPExcel->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray( * $objPHPExcel->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray(
* array( * array(
* 'code' => PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE * 'code' => PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE
* ) * )
* ); * );
* </code> * </code>
* *
@ -497,8 +493,8 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
/** /**
* Convert a value in a pre-defined format to a PHP string * Convert a value in a pre-defined format to a PHP string
* *
* @param mixed $value Value to format * @param mixed $value Value to format
* @param string $format Format code * @param string $format Format code
* @param array $callBack Callback function for additional formatting of string * @param array $callBack Callback function for additional formatting of string
* @return string Formatted string * @return string Formatted string
*/ */
@ -623,7 +619,7 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
// Scale thousands, millions,... // Scale thousands, millions,...
// This is indicated by a number of commas after a digit placeholder: // This is indicated by a number of commas after a digit placeholder:
// #, or 0.0,, // #, or 0.0,,
$scale = 1; // same as no scale $scale = 1; // same as no scale
$matches = array(); $matches = array();
if (preg_match('/(#|0)(,+)/', $format, $matches)) { if (preg_match('/(#|0)(,+)/', $format, $matches)) {

View File

@ -337,13 +337,13 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
$this->_pageSetup = new PHPExcel_Worksheet_PageSetup(); $this->_pageSetup = new PHPExcel_Worksheet_PageSetup();
// Set page margins // Set page margins
$this->_pageMargins = new PHPExcel_Worksheet_PageMargins(); $this->_pageMargins = new PHPExcel_Worksheet_PageMargins();
// Set page header/footer // Set page header/footer
$this->_headerFooter = new PHPExcel_Worksheet_HeaderFooter(); $this->_headerFooter = new PHPExcel_Worksheet_HeaderFooter();
// Set sheet view // Set sheet view
$this->_sheetView = new PHPExcel_Worksheet_SheetView(); $this->_sheetView = new PHPExcel_Worksheet_SheetView();
// Drawing collection // Drawing collection
$this->_drawingCollection = new ArrayObject(); $this->_drawingCollection = new ArrayObject();
@ -351,14 +351,6 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
// Protection // Protection
$this->_protection = new PHPExcel_Worksheet_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 // Default row dimension
$this->_defaultRowDimension = new PHPExcel_Worksheet_RowDimension(null); $this->_defaultRowDimension = new PHPExcel_Worksheet_RowDimension(null);

View File

@ -8,12 +8,12 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * 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, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 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) * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
*/ */
class PHPExcel_Worksheet_ColumnDimension class PHPExcel_Worksheet_ColumnDimension
{ {
/** /**
* Column index * Column index
* *
* @var int * @var int
*/ */
private $_columnIndex; private $_columnIndex;
/** /**
* Column width * Column width
* *
@ -49,35 +49,35 @@ class PHPExcel_Worksheet_ColumnDimension
* *
* @var double * @var double
*/ */
private $_width; private $_width = -1;
/** /**
* Auto size? * Auto size?
* *
* @var bool * @var bool
*/ */
private $_autoSize; private $_autoSize = false;
/** /**
* Visible? * Visible?
* *
* @var bool * @var bool
*/ */
private $_visible; private $_visible = true;
/** /**
* Outline level * Outline level
* *
* @var int * @var int
*/ */
private $_outlineLevel = 0; private $_outlineLevel = 0;
/** /**
* Collapsed * Collapsed
* *
* @var bool * @var bool
*/ */
private $_collapsed; private $_collapsed = false;
/** /**
* Index to cellXf * Index to cellXf
@ -95,16 +95,11 @@ class PHPExcel_Worksheet_ColumnDimension
{ {
// Initialise values // Initialise values
$this->_columnIndex = $pIndex; $this->_columnIndex = $pIndex;
$this->_width = -1;
$this->_autoSize = false;
$this->_visible = true;
$this->_outlineLevel = 0;
$this->_collapsed = false;
// set default index to cellXf // set default index to cellXf
$this->_xfIndex = 0; $this->_xfIndex = 0;
} }
/** /**
* Get ColumnIndex * Get ColumnIndex
* *
@ -113,7 +108,7 @@ class PHPExcel_Worksheet_ColumnDimension
public function getColumnIndex() { public function getColumnIndex() {
return $this->_columnIndex; return $this->_columnIndex;
} }
/** /**
* Set ColumnIndex * Set ColumnIndex
* *
@ -124,7 +119,7 @@ class PHPExcel_Worksheet_ColumnDimension
$this->_columnIndex = $pValue; $this->_columnIndex = $pValue;
return $this; return $this;
} }
/** /**
* Get Width * Get Width
* *
@ -133,7 +128,7 @@ class PHPExcel_Worksheet_ColumnDimension
public function getWidth() { public function getWidth() {
return $this->_width; return $this->_width;
} }
/** /**
* Set Width * Set Width
* *
@ -144,7 +139,7 @@ class PHPExcel_Worksheet_ColumnDimension
$this->_width = $pValue; $this->_width = $pValue;
return $this; return $this;
} }
/** /**
* Get Auto Size * Get Auto Size
* *
@ -153,7 +148,7 @@ class PHPExcel_Worksheet_ColumnDimension
public function getAutoSize() { public function getAutoSize() {
return $this->_autoSize; return $this->_autoSize;
} }
/** /**
* Set Auto Size * Set Auto Size
* *
@ -164,7 +159,7 @@ class PHPExcel_Worksheet_ColumnDimension
$this->_autoSize = $pValue; $this->_autoSize = $pValue;
return $this; return $this;
} }
/** /**
* Get Visible * Get Visible
* *
@ -173,7 +168,7 @@ class PHPExcel_Worksheet_ColumnDimension
public function getVisible() { public function getVisible() {
return $this->_visible; return $this->_visible;
} }
/** /**
* Set Visible * Set Visible
* *
@ -184,7 +179,7 @@ class PHPExcel_Worksheet_ColumnDimension
$this->_visible = $pValue; $this->_visible = $pValue;
return $this; return $this;
} }
/** /**
* Get Outline Level * Get Outline Level
* *
@ -193,7 +188,7 @@ class PHPExcel_Worksheet_ColumnDimension
public function getOutlineLevel() { public function getOutlineLevel() {
return $this->_outlineLevel; return $this->_outlineLevel;
} }
/** /**
* Set Outline Level * Set Outline Level
* *
@ -207,11 +202,11 @@ class PHPExcel_Worksheet_ColumnDimension
if ($pValue < 0 || $pValue > 7) { if ($pValue < 0 || $pValue > 7) {
throw new Exception("Outline level must range between 0 and 7."); throw new Exception("Outline level must range between 0 and 7.");
} }
$this->_outlineLevel = $pValue; $this->_outlineLevel = $pValue;
return $this; return $this;
} }
/** /**
* Get Collapsed * Get Collapsed
* *
@ -220,7 +215,7 @@ class PHPExcel_Worksheet_ColumnDimension
public function getCollapsed() { public function getCollapsed() {
return $this->_collapsed; return $this->_collapsed;
} }
/** /**
* Set Collapsed * Set Collapsed
* *
@ -231,7 +226,7 @@ class PHPExcel_Worksheet_ColumnDimension
$this->_collapsed = $pValue; $this->_collapsed = $pValue;
return $this; return $this;
} }
/** /**
* Get index to cellXf * Get index to cellXf
* *

View File

@ -108,70 +108,70 @@ class PHPExcel_Worksheet_HeaderFooter
* *
* @var string * @var string
*/ */
private $_oddHeader; private $_oddHeader = '';
/** /**
* OddFooter * OddFooter
* *
* @var string * @var string
*/ */
private $_oddFooter; private $_oddFooter = '';
/** /**
* EvenHeader * EvenHeader
* *
* @var string * @var string
*/ */
private $_evenHeader; private $_evenHeader = '';
/** /**
* EvenFooter * EvenFooter
* *
* @var string * @var string
*/ */
private $_evenFooter; private $_evenFooter = '';
/** /**
* FirstHeader * FirstHeader
* *
* @var string * @var string
*/ */
private $_firstHeader; private $_firstHeader = '';
/** /**
* FirstFooter * FirstFooter
* *
* @var string * @var string
*/ */
private $_firstFooter; private $_firstFooter = '';
/** /**
* Different header for Odd/Even, defaults to false * Different header for Odd/Even, defaults to false
* *
* @var boolean * @var boolean
*/ */
private $_differentOddEven; private $_differentOddEven = false;
/** /**
* Different header for first page, defaults to false * Different header for first page, defaults to false
* *
* @var boolean * @var boolean
*/ */
private $_differentFirst; private $_differentFirst = false;
/** /**
* Scale with document, defaults to true * Scale with document, defaults to true
* *
* @var boolean * @var boolean
*/ */
private $_scaleWithDocument; private $_scaleWithDocument = true;
/** /**
* Align with margins, defaults to true * Align with margins, defaults to true
* *
* @var boolean * @var boolean
*/ */
private $_alignWithMargins; private $_alignWithMargins = true;
/** /**
* Header/footer images * Header/footer images
@ -185,18 +185,6 @@ class PHPExcel_Worksheet_HeaderFooter
*/ */
public function __construct() 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();
} }
/** /**

View File

@ -8,12 +8,12 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * 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, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 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) * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
*/ */
class PHPExcel_Worksheet_PageMargins class PHPExcel_Worksheet_PageMargins
{ {
/** /**
* Left * Left
* *
* @var double * @var double
*/ */
private $_left; private $_left = 0.7;
/** /**
* Right * Right
* *
* @var double * @var double
*/ */
private $_right; private $_right = 0.7;
/** /**
* Top * Top
* *
* @var double * @var double
*/ */
private $_top; private $_top = 0.75;
/** /**
* Bottom * Bottom
* *
* @var double * @var double
*/ */
private $_bottom; private $_bottom = 0.75;
/** /**
* Header * Header
* *
* @var double * @var double
*/ */
private $_header; private $_header = 0.3;
/** /**
* Footer * Footer
* *
* @var double * @var double
*/ */
private $_footer; private $_footer = 0.3;
/** /**
* Create a new PHPExcel_Worksheet_PageMargins * Create a new PHPExcel_Worksheet_PageMargins
*/ */
public function __construct() 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 * Get Left
* *
@ -99,7 +92,7 @@ class PHPExcel_Worksheet_PageMargins
public function getLeft() { public function getLeft() {
return $this->_left; return $this->_left;
} }
/** /**
* Set Left * Set Left
* *
@ -110,7 +103,7 @@ class PHPExcel_Worksheet_PageMargins
$this->_left = $pValue; $this->_left = $pValue;
return $this; return $this;
} }
/** /**
* Get Right * Get Right
* *
@ -119,7 +112,7 @@ class PHPExcel_Worksheet_PageMargins
public function getRight() { public function getRight() {
return $this->_right; return $this->_right;
} }
/** /**
* Set Right * Set Right
* *
@ -130,7 +123,7 @@ class PHPExcel_Worksheet_PageMargins
$this->_right = $pValue; $this->_right = $pValue;
return $this; return $this;
} }
/** /**
* Get Top * Get Top
* *
@ -139,7 +132,7 @@ class PHPExcel_Worksheet_PageMargins
public function getTop() { public function getTop() {
return $this->_top; return $this->_top;
} }
/** /**
* Set Top * Set Top
* *
@ -150,7 +143,7 @@ class PHPExcel_Worksheet_PageMargins
$this->_top = $pValue; $this->_top = $pValue;
return $this; return $this;
} }
/** /**
* Get Bottom * Get Bottom
* *
@ -159,7 +152,7 @@ class PHPExcel_Worksheet_PageMargins
public function getBottom() { public function getBottom() {
return $this->_bottom; return $this->_bottom;
} }
/** /**
* Set Bottom * Set Bottom
* *
@ -170,7 +163,7 @@ class PHPExcel_Worksheet_PageMargins
$this->_bottom = $pValue; $this->_bottom = $pValue;
return $this; return $this;
} }
/** /**
* Get Header * Get Header
* *
@ -179,7 +172,7 @@ class PHPExcel_Worksheet_PageMargins
public function getHeader() { public function getHeader() {
return $this->_header; return $this->_header;
} }
/** /**
* Set Header * Set Header
* *
@ -190,7 +183,7 @@ class PHPExcel_Worksheet_PageMargins
$this->_header = $pValue; $this->_header = $pValue;
return $this; return $this;
} }
/** /**
* Get Footer * Get Footer
* *
@ -199,7 +192,7 @@ class PHPExcel_Worksheet_PageMargins
public function getFooter() { public function getFooter() {
return $this->_footer; return $this->_footer;
} }
/** /**
* Set Footer * Set Footer
* *
@ -210,7 +203,7 @@ class PHPExcel_Worksheet_PageMargins
$this->_footer = $pValue; $this->_footer = $pValue;
return $this; return $this;
} }
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */

View File

@ -189,14 +189,14 @@ class PHPExcel_Worksheet_PageSetup
* *
* @var int * @var int
*/ */
private $_paperSize; private $_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER;
/** /**
* Orientation * Orientation
* *
* @var string * @var string
*/ */
private $_orientation; private $_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT;
/** /**
* Scale (Print Scale) * Scale (Print Scale)
@ -206,7 +206,7 @@ class PHPExcel_Worksheet_PageSetup
* *
* @var int? * @var int?
*/ */
private $_scale; private $_scale = 100;
/** /**
* Fit To Page * Fit To Page
@ -214,7 +214,7 @@ class PHPExcel_Worksheet_PageSetup
* *
* @var boolean * @var boolean
*/ */
private $_fitToPage; private $_fitToPage = false;
/** /**
* Fit To Height * Fit To Height
@ -222,7 +222,7 @@ class PHPExcel_Worksheet_PageSetup
* *
* @var int? * @var int?
*/ */
private $_fitToHeight; private $_fitToHeight = 1;
/** /**
* Fit To Width * Fit To Width
@ -230,7 +230,7 @@ class PHPExcel_Worksheet_PageSetup
* *
* @var int? * @var int?
*/ */
private $_fitToWidth; private $_fitToWidth = 1;
/** /**
* Columns to repeat at left * Columns to repeat at left
@ -279,19 +279,6 @@ class PHPExcel_Worksheet_PageSetup
*/ */
public function __construct() 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;
} }
/** /**

View File

@ -40,143 +40,125 @@ class PHPExcel_Worksheet_Protection
* *
* @var boolean * @var boolean
*/ */
private $_sheet; private $_sheet = false;
/** /**
* Objects * Objects
* *
* @var boolean * @var boolean
*/ */
private $_objects; private $_objects = false;
/** /**
* Scenarios * Scenarios
* *
* @var boolean * @var boolean
*/ */
private $_scenarios; private $_scenarios = false;
/** /**
* Format cells * Format cells
* *
* @var boolean * @var boolean
*/ */
private $_formatCells; private $_formatCells = false;
/** /**
* Format columns * Format columns
* *
* @var boolean * @var boolean
*/ */
private $_formatColumns; private $_formatColumns = false;
/** /**
* Format rows * Format rows
* *
* @var boolean * @var boolean
*/ */
private $_formatRows; private $_formatRows = false;
/** /**
* Insert columns * Insert columns
* *
* @var boolean * @var boolean
*/ */
private $_insertColumns; private $_insertColumns = false;
/** /**
* Insert rows * Insert rows
* *
* @var boolean * @var boolean
*/ */
private $_insertRows; private $_insertRows = false;
/** /**
* Insert hyperlinks * Insert hyperlinks
* *
* @var boolean * @var boolean
*/ */
private $_insertHyperlinks; private $_insertHyperlinks = false;
/** /**
* Delete columns * Delete columns
* *
* @var boolean * @var boolean
*/ */
private $_deleteColumns; private $_deleteColumns = false;
/** /**
* Delete rows * Delete rows
* *
* @var boolean * @var boolean
*/ */
private $_deleteRows; private $_deleteRows = false;
/** /**
* Select locked cells * Select locked cells
* *
* @var boolean * @var boolean
*/ */
private $_selectLockedCells; private $_selectLockedCells = false;
/** /**
* Sort * Sort
* *
* @var boolean * @var boolean
*/ */
private $_sort; private $_sort = false;
/** /**
* AutoFilter * AutoFilter
* *
* @var boolean * @var boolean
*/ */
private $_autoFilter; private $_autoFilter = false;
/** /**
* Pivot tables * Pivot tables
* *
* @var boolean * @var boolean
*/ */
private $_pivotTables; private $_pivotTables = false;
/** /**
* Select unlocked cells * Select unlocked cells
* *
* @var boolean * @var boolean
*/ */
private $_selectUnlockedCells; private $_selectUnlockedCells = false;
/** /**
* Password * Password
* *
* @var string * @var string
*/ */
private $_password; private $_password = '';
/** /**
* Create a new PHPExcel_Worksheet_Protection * Create a new PHPExcel_Worksheet_Protection
*/ */
public function __construct() 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 = '';
} }
/** /**

View File

@ -8,12 +8,12 @@
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * 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, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 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) * @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
*/ */
class PHPExcel_Worksheet_RowDimension class PHPExcel_Worksheet_RowDimension
{ {
/** /**
* Row index * Row index
* *
* @var int * @var int
*/ */
private $_rowIndex; private $_rowIndex;
/** /**
* Row height (in pt) * Row height (in pt)
* *
@ -49,28 +49,28 @@ class PHPExcel_Worksheet_RowDimension
* *
* @var double * @var double
*/ */
private $_rowHeight; private $_rowHeight = -1;
/** /**
* Visible? * Visible?
* *
* @var bool * @var bool
*/ */
private $_visible; private $_visible = true;
/** /**
* Outline level * Outline level
* *
* @var int * @var int
*/ */
private $_outlineLevel = 0; private $_outlineLevel = 0;
/** /**
* Collapsed * Collapsed
* *
* @var bool * @var bool
*/ */
private $_collapsed; private $_collapsed = false;
/** /**
* Index to cellXf. Null value means row has no explicit cellXf format. * Index to cellXf. Null value means row has no explicit cellXf format.
@ -88,15 +88,11 @@ class PHPExcel_Worksheet_RowDimension
{ {
// Initialise values // Initialise values
$this->_rowIndex = $pIndex; $this->_rowIndex = $pIndex;
$this->_rowHeight = -1;
$this->_visible = true;
$this->_outlineLevel = 0;
$this->_collapsed = false;
// set row dimension as unformatted by default // set row dimension as unformatted by default
$this->_xfIndex = null; $this->_xfIndex = null;
} }
/** /**
* Get Row Index * Get Row Index
* *
@ -105,7 +101,7 @@ class PHPExcel_Worksheet_RowDimension
public function getRowIndex() { public function getRowIndex() {
return $this->_rowIndex; return $this->_rowIndex;
} }
/** /**
* Set Row Index * Set Row Index
* *
@ -116,7 +112,7 @@ class PHPExcel_Worksheet_RowDimension
$this->_rowIndex = $pValue; $this->_rowIndex = $pValue;
return $this; return $this;
} }
/** /**
* Get Row Height * Get Row Height
* *
@ -125,7 +121,7 @@ class PHPExcel_Worksheet_RowDimension
public function getRowHeight() { public function getRowHeight() {
return $this->_rowHeight; return $this->_rowHeight;
} }
/** /**
* Set Row Height * Set Row Height
* *
@ -136,7 +132,7 @@ class PHPExcel_Worksheet_RowDimension
$this->_rowHeight = $pValue; $this->_rowHeight = $pValue;
return $this; return $this;
} }
/** /**
* Get Visible * Get Visible
* *
@ -145,7 +141,7 @@ class PHPExcel_Worksheet_RowDimension
public function getVisible() { public function getVisible() {
return $this->_visible; return $this->_visible;
} }
/** /**
* Set Visible * Set Visible
* *
@ -156,7 +152,7 @@ class PHPExcel_Worksheet_RowDimension
$this->_visible = $pValue; $this->_visible = $pValue;
return $this; return $this;
} }
/** /**
* Get Outline Level * Get Outline Level
* *
@ -165,7 +161,7 @@ class PHPExcel_Worksheet_RowDimension
public function getOutlineLevel() { public function getOutlineLevel() {
return $this->_outlineLevel; return $this->_outlineLevel;
} }
/** /**
* Set Outline Level * Set Outline Level
* *
@ -179,11 +175,11 @@ class PHPExcel_Worksheet_RowDimension
if ($pValue < 0 || $pValue > 7) { if ($pValue < 0 || $pValue > 7) {
throw new Exception("Outline level must range between 0 and 7."); throw new Exception("Outline level must range between 0 and 7.");
} }
$this->_outlineLevel = $pValue; $this->_outlineLevel = $pValue;
return $this; return $this;
} }
/** /**
* Get Collapsed * Get Collapsed
* *
@ -192,7 +188,7 @@ class PHPExcel_Worksheet_RowDimension
public function getCollapsed() { public function getCollapsed() {
return $this->_collapsed; return $this->_collapsed;
} }
/** /**
* Set Collapsed * Set Collapsed
* *

View File

@ -37,30 +37,27 @@ class PHPExcel_Worksheet_SheetView
{ {
/** /**
* ZoomScale * ZoomScale
* *
* Valid values range from 10 to 400. * Valid values range from 10 to 400.
* *
* @var int * @var int
*/ */
private $_zoomScale; private $_zoomScale = 100;
/** /**
* ZoomScaleNormal * ZoomScaleNormal
* *
* Valid values range from 10 to 400. * Valid values range from 10 to 400.
* *
* @var int * @var int
*/ */
private $_zoomScaleNormal; private $_zoomScaleNormal = 100;
/** /**
* Create a new PHPExcel_Worksheet_SheetView * Create a new PHPExcel_Worksheet_SheetView
*/ */
public function __construct() public function __construct()
{ {
// Initialise values
$this->_zoomScale = 100;
$this->_zoomScaleNormal = 100;
} }
/** /**
@ -91,7 +88,7 @@ class PHPExcel_Worksheet_SheetView
} }
return $this; return $this;
} }
/** /**
* Get ZoomScaleNormal * Get ZoomScaleNormal
* *

View File

@ -46,28 +46,28 @@ class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter {
* *
* @var string * @var string
*/ */
private $_delimiter; private $_delimiter = ',';
/** /**
* Enclosure * Enclosure
* *
* @var string * @var string
*/ */
private $_enclosure; private $_enclosure = '"';
/** /**
* Line ending * Line ending
* *
* @var string * @var string
*/ */
private $_lineEnding; private $_lineEnding = PHP_EOL;
/** /**
* Sheet index to write * Sheet index to write
* *
* @var int * @var int
*/ */
private $_sheetIndex; private $_sheetIndex = 0;
/** /**
* Pre-calculate formulas * Pre-calculate formulas
@ -90,10 +90,6 @@ class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter {
*/ */
public function __construct(PHPExcel $phpExcel) { public function __construct(PHPExcel $phpExcel) {
$this->_phpExcel = $phpExcel; $this->_phpExcel = $phpExcel;
$this->_delimiter = ',';
$this->_enclosure = '"';
$this->_lineEnding = PHP_EOL;
$this->_sheetIndex = 0;
} }
/** /**

View File

@ -40,7 +40,7 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter
* *
* @var boolean * @var boolean
*/ */
private $_preCalculateFormulas; private $_preCalculateFormulas = true;
/** /**
* PHPExcel object * PHPExcel object
@ -54,28 +54,28 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter
* *
* @var integer * @var integer
*/ */
private $_BIFF_version; private $_BIFF_version = 0x0600;
/** /**
* Total number of shared strings in workbook * Total number of shared strings in workbook
* *
* @var int * @var int
*/ */
private $_str_total; private $_str_total = 0;
/** /**
* Number of unique shared strings in workbook * Number of unique shared strings in workbook
* *
* @var int * @var int
*/ */
private $_str_unique; private $_str_unique = 0;
/** /**
* Array of unique shared strings in workbook * Array of unique shared strings in workbook
* *
* @var array * @var array
*/ */
private $_str_table; private $_str_table = array();
/** /**
* Color cache. Mapping between RGB value and color index. * 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 * @param PHPExcel $phpExcel PHPExcel object
*/ */
public function __construct(PHPExcel $phpExcel) { public function __construct(PHPExcel $phpExcel) {
$this->_preCalculateFormulas = true;
$this->_phpExcel = $phpExcel; $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);
} }
/** /**

View File

@ -46,7 +46,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
* *
* @var int * @var int
*/ */
private $_sheetIndex; private $_sheetIndex = 0;
/** /**
* Pre-calculate formulas * Pre-calculate formulas
@ -60,7 +60,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
* *
* @var string * @var string
*/ */
private $_imagesRoot = '.'; private $_imagesRoot = '.';
/** /**
* Use inline CSS? * Use inline CSS?
@ -95,28 +95,28 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
* *
* @var boolean * @var boolean
*/ */
private $_spansAreCalculated; private $_spansAreCalculated = false;
/** /**
* Excel cells that should not be written as HTML cells * Excel cells that should not be written as HTML cells
* *
* @var array * @var array
*/ */
private $_isSpannedCell; private $_isSpannedCell = array();
/** /**
* Excel cells that are upper-left corner in a cell merge * Excel cells that are upper-left corner in a cell merge
* *
* @var array * @var array
*/ */
private $_isBaseCell; private $_isBaseCell = array();
/** /**
* Excel rows that should not be written as HTML rows * Excel rows that should not be written as HTML rows
* *
* @var array * @var array
*/ */
private $_isSpannedRow; private $_isSpannedRow = array();
/** /**
* Is the current writer creating PDF? * Is the current writer creating PDF?
@ -140,13 +140,6 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
public function __construct(PHPExcel $phpExcel) { public function __construct(PHPExcel $phpExcel) {
$this->_phpExcel = $phpExcel; $this->_phpExcel = $phpExcel;
$this->_defaultFont = $this->_phpExcel->getDefaultStyle()->getFont(); $this->_defaultFont = $this->_phpExcel->getDefaultStyle()->getFont();
$this->_sheetIndex = 0;
$this->_imagesRoot = '.';
$this->_spansAreCalculated = false;
$this->_isSpannedCell = array();
$this->_isBaseCell = array();
$this->_isSpannedRow = array();
} }
/** /**