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

View File

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

View File

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

View File

@ -431,7 +431,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
// add style to cellXf collection
$objStyle = new PHPExcel_Style;
$this->_readStyle($objStyle, $style);
self::_readStyle($objStyle, $style);
$excel->addCellXf($objStyle);
}
@ -458,7 +458,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
// add style to cellStyleXf collection
$objStyle = new PHPExcel_Style;
$this->_readStyle($objStyle, $cellStyle);
self::_readStyle($objStyle, $cellStyle);
$excel->addCellStyleXf($objStyle);
}
}
@ -468,7 +468,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
if ($xmlStyles->dxfs) {
foreach ($xmlStyles->dxfs->dxf as $dxf) {
$style = new PHPExcel_Style;
$this->_readStyle($style, $dxf);
self::_readStyle($style, $dxf);
$dxfs[] = $style;
}
}
@ -480,7 +480,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
if (isset($cellStyles[intval($cellStyle['xfId'])])) {
// Set default style
$style = new PHPExcel_Style;
$this->_readStyle($style, $cellStyles[intval($cellStyle['xfId'])]);
self::_readStyle($style, $cellStyles[intval($cellStyle['xfId'])]);
// normal style, currently not using it for anything
}
@ -1439,7 +1439,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
}
}
private function _readStyle($docStyle, $style) {
private static function _readStyle($docStyle, $style) {
// format code
if (isset($style->numFmt)) {
$docStyle->getNumberFormat()->setFormatCode($style->numFmt);

View File

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

View File

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

View File

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

View File

@ -54,42 +54,42 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
*
* @var string
*/
private $_horizontal;
private $_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
/**
* Vertical
*
* @var string
*/
private $_vertical;
private $_vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
/**
* Text rotation
*
* @var int
*/
private $_textRotation;
private $_textRotation = 0;
/**
* Wrap text
*
* @var boolean
*/
private $_wrapText;
private $_wrapText = false;
/**
* Shrink to fit
*
* @var boolean
*/
private $_shrinkToFit;
private $_shrinkToFit = false;
/**
* Indent - only possible with horizontal alignment left and right
*
* @var int
*/
private $_indent;
private $_indent = 0;
/**
* Parent Borders
@ -119,14 +119,6 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
{
// Supervisor?
$this->_isSupervisor = $isSupervisor;
// Initialise values
$this->_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
$this->_vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
$this->_textRotation = 0;
$this->_wrapText = false;
$this->_shrinkToFit = false;
$this->_indent = 0;
}
/**

View File

@ -56,7 +56,7 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
*
* @var string
*/
private $_borderStyle;
private $_borderStyle = PHPExcel_Style_Border::BORDER_NONE;
/**
* Border color
@ -95,7 +95,6 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
$this->_isSupervisor = $isSupervisor;
// Initialise values
$this->_borderStyle = PHPExcel_Style_Border::BORDER_NONE;
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
// bind parent if we are a supervisor

View File

@ -63,14 +63,14 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
*
* @var string
*/
private $_fillType;
private $_fillType = PHPExcel_Style_Fill::FILL_NONE;
/**
* Rotation
*
* @var double
*/
private $_rotation;
private $_rotation = 0;
/**
* Start color
@ -116,8 +116,6 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
$this->_isSupervisor = $isSupervisor;
// 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->_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';
/**
* Name
* Font Name
*
* @var string
*/
private $_name;
private $_name = 'Calibri';
/**
* Font Size
*
* @var float
*/
private $_size = 11;
/**
* Bold
*
* @var boolean
*/
private $_bold;
private $_bold = false;
/**
* Italic
*
* @var boolean
*/
private $_italic;
private $_italic = false;
/**
* Superscript
*
* @var boolean
*/
private $_superScript;
private $_superScript = false;
/**
* Subscript
*
* @var boolean
*/
private $_subScript;
private $_subScript = false;
/**
* Underline
*
* @var string
*/
private $_underline;
private $_underline = PHPExcel_Style_Font::UNDERLINE_NONE;
/**
* Strikethrough
*
* @var boolean
*/
private $_strikethrough;
private $_strikethrough = false;
/**
* Foreground color
@ -128,14 +135,6 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
$this->_isSupervisor = $isSupervisor;
// Initialise values
$this->_name = 'Calibri';
$this->_size = 11;
$this->_bold = false;
$this->_italic = false;
$this->_superScript = false;
$this->_subScript = false;
$this->_underline = PHPExcel_Style_Font::UNDERLINE_NONE;
$this->_strikethrough = false;
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
// bind parent if we are a supervisor

View File

@ -94,14 +94,14 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
*
* @var string
*/
private $_formatCode;
private $_formatCode = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
/**
* Built-in format Code
*
* @var string
*/
private $_builtInFormatCode;
private $_builtInFormatCode = 0;
/**
* Parent Borders
@ -131,10 +131,6 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
{
// Supervisor?
$this->_isSupervisor = $isSupervisor;
// Initialise values
$this->_formatCode = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
$this->_builtInFormatCode = 0;
}
/**

View File

@ -351,14 +351,6 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
// Protection
$this->_protection = new PHPExcel_Worksheet_Protection();
// Gridlines
$this->_showGridlines = true;
$this->_printGridlines = false;
// Outline summary
$this->_showSummaryBelow = true;
$this->_showSummaryRight = true;
// Default row dimension
$this->_defaultRowDimension = new PHPExcel_Worksheet_RowDimension(null);

View File

@ -49,21 +49,21 @@ class PHPExcel_Worksheet_ColumnDimension
*
* @var double
*/
private $_width;
private $_width = -1;
/**
* Auto size?
*
* @var bool
*/
private $_autoSize;
private $_autoSize = false;
/**
* Visible?
*
* @var bool
*/
private $_visible;
private $_visible = true;
/**
* Outline level
@ -77,7 +77,7 @@ class PHPExcel_Worksheet_ColumnDimension
*
* @var bool
*/
private $_collapsed;
private $_collapsed = false;
/**
* Index to cellXf
@ -95,11 +95,6 @@ class PHPExcel_Worksheet_ColumnDimension
{
// Initialise values
$this->_columnIndex = $pIndex;
$this->_width = -1;
$this->_autoSize = false;
$this->_visible = true;
$this->_outlineLevel = 0;
$this->_collapsed = false;
// set default index to cellXf
$this->_xfIndex = 0;

View File

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

View File

@ -40,55 +40,48 @@ class PHPExcel_Worksheet_PageMargins
*
* @var double
*/
private $_left;
private $_left = 0.7;
/**
* Right
*
* @var double
*/
private $_right;
private $_right = 0.7;
/**
* Top
*
* @var double
*/
private $_top;
private $_top = 0.75;
/**
* Bottom
*
* @var double
*/
private $_bottom;
private $_bottom = 0.75;
/**
* Header
*
* @var double
*/
private $_header;
private $_header = 0.3;
/**
* Footer
*
* @var double
*/
private $_footer;
private $_footer = 0.3;
/**
* Create a new PHPExcel_Worksheet_PageMargins
*/
public function __construct()
{
// Initialise values
$this->_left = 0.7;
$this->_right = 0.7;
$this->_top = 0.75;
$this->_bottom = 0.75;
$this->_header = 0.3;
$this->_footer = 0.3;
}
/**

View File

@ -189,14 +189,14 @@ class PHPExcel_Worksheet_PageSetup
*
* @var int
*/
private $_paperSize;
private $_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER;
/**
* Orientation
*
* @var string
*/
private $_orientation;
private $_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT;
/**
* Scale (Print Scale)
@ -206,7 +206,7 @@ class PHPExcel_Worksheet_PageSetup
*
* @var int?
*/
private $_scale;
private $_scale = 100;
/**
* Fit To Page
@ -214,7 +214,7 @@ class PHPExcel_Worksheet_PageSetup
*
* @var boolean
*/
private $_fitToPage;
private $_fitToPage = false;
/**
* Fit To Height
@ -222,7 +222,7 @@ class PHPExcel_Worksheet_PageSetup
*
* @var int?
*/
private $_fitToHeight;
private $_fitToHeight = 1;
/**
* Fit To Width
@ -230,7 +230,7 @@ class PHPExcel_Worksheet_PageSetup
*
* @var int?
*/
private $_fitToWidth;
private $_fitToWidth = 1;
/**
* Columns to repeat at left
@ -279,19 +279,6 @@ class PHPExcel_Worksheet_PageSetup
*/
public function __construct()
{
// Initialise values
$this->_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER;
$this->_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT;
$this->_scale = 100;
$this->_fitToPage = false;
$this->_fitToHeight = 1;
$this->_fitToWidth = 1;
$this->_columnsToRepeatAtLeft = array('', '');
$this->_rowsToRepeatAtTop = array(0, 0);
$this->_horizontalCentered = false;
$this->_verticalCentered = false;
$this->_printArea = null;
$this->_firstPageNumber = null;
}
/**

View File

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

View File

@ -49,14 +49,14 @@ class PHPExcel_Worksheet_RowDimension
*
* @var double
*/
private $_rowHeight;
private $_rowHeight = -1;
/**
* Visible?
*
* @var bool
*/
private $_visible;
private $_visible = true;
/**
* Outline level
@ -70,7 +70,7 @@ class PHPExcel_Worksheet_RowDimension
*
* @var bool
*/
private $_collapsed;
private $_collapsed = false;
/**
* Index to cellXf. Null value means row has no explicit cellXf format.
@ -88,10 +88,6 @@ class PHPExcel_Worksheet_RowDimension
{
// Initialise values
$this->_rowIndex = $pIndex;
$this->_rowHeight = -1;
$this->_visible = true;
$this->_outlineLevel = 0;
$this->_collapsed = false;
// set row dimension as unformatted by default
$this->_xfIndex = null;

View File

@ -42,7 +42,7 @@ class PHPExcel_Worksheet_SheetView
*
* @var int
*/
private $_zoomScale;
private $_zoomScale = 100;
/**
* ZoomScaleNormal
@ -51,16 +51,13 @@ class PHPExcel_Worksheet_SheetView
*
* @var int
*/
private $_zoomScaleNormal;
private $_zoomScaleNormal = 100;
/**
* Create a new PHPExcel_Worksheet_SheetView
*/
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
*/
private $_delimiter;
private $_delimiter = ',';
/**
* Enclosure
*
* @var string
*/
private $_enclosure;
private $_enclosure = '"';
/**
* Line ending
*
* @var string
*/
private $_lineEnding;
private $_lineEnding = PHP_EOL;
/**
* Sheet index to write
*
* @var int
*/
private $_sheetIndex;
private $_sheetIndex = 0;
/**
* Pre-calculate formulas
@ -90,10 +90,6 @@ class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter {
*/
public function __construct(PHPExcel $phpExcel) {
$this->_phpExcel = $phpExcel;
$this->_delimiter = ',';
$this->_enclosure = '"';
$this->_lineEnding = PHP_EOL;
$this->_sheetIndex = 0;
}
/**

View File

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

View File

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