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 . $this->_contiguousRow)->setValue($rowData[$i]); $objPHPExcel->getActiveSheet()->getCell($columnLetter . $currentRow)->setValue($rowDatum);
} 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

@ -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
@ -119,14 +119,6 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
{ {
// 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;
} }
/** /**

View File

@ -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
@ -95,7 +95,6 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
$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

View File

@ -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
@ -116,8 +116,6 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
$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);

View File

@ -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
@ -128,14 +135,6 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
$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

View File

@ -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;
} }
/** /**

View File

@ -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

@ -49,21 +49,21 @@ 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
@ -77,7 +77,7 @@ class PHPExcel_Worksheet_ColumnDimension
* *
* @var bool * @var bool
*/ */
private $_collapsed; private $_collapsed = false;
/** /**
* Index to cellXf * Index to cellXf
@ -95,11 +95,6 @@ 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;

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

@ -40,55 +40,48 @@ class PHPExcel_Worksheet_PageMargins
* *
* @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;
} }
/** /**

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

@ -49,14 +49,14 @@ 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
@ -70,7 +70,7 @@ class PHPExcel_Worksheet_RowDimension
* *
* @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,10 +88,6 @@ 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;

View File

@ -42,7 +42,7 @@ class PHPExcel_Worksheet_SheetView
* *
* @var int * @var int
*/ */
private $_zoomScale; private $_zoomScale = 100;
/** /**
* ZoomScaleNormal * ZoomScaleNormal
@ -51,16 +51,13 @@ class PHPExcel_Worksheet_SheetView
* *
* @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;
} }
/** /**

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
@ -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();
} }
/** /**