Another big blast of psr-2 changes. Getting close to the finishing line now

This commit is contained in:
MarkBaker 2015-05-22 08:03:34 +01:00
parent 85692956a7
commit 3dcdba0c67
22 changed files with 410 additions and 524 deletions

View File

@ -2841,17 +2841,17 @@ class PHPExcel_Calculation
// Examine each of the two operands, and turn them into an array if they aren't one already // Examine each of the two operands, and turn them into an array if they aren't one already
// Note that this function should only be called if one or both of the operand is already an array // Note that this function should only be called if one or both of the operand is already an array
if (!is_array($operand1)) { if (!is_array($operand1)) {
list($matrixRows, $matrixColumns) = self::_getMatrixDimensions($operand2); list($matrixRows, $matrixColumns) = self::getMatrixDimensions($operand2);
$operand1 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand1)); $operand1 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand1));
$resize = 0; $resize = 0;
} elseif (!is_array($operand2)) { } elseif (!is_array($operand2)) {
list($matrixRows, $matrixColumns) = self::_getMatrixDimensions($operand1); list($matrixRows, $matrixColumns) = self::getMatrixDimensions($operand1);
$operand2 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand2)); $operand2 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand2));
$resize = 0; $resize = 0;
} }
list($matrix1Rows, $matrix1Columns) = self::_getMatrixDimensions($operand1); list($matrix1Rows, $matrix1Columns) = self::getMatrixDimensions($operand1);
list($matrix2Rows, $matrix2Columns) = self::_getMatrixDimensions($operand2); list($matrix2Rows, $matrix2Columns) = self::getMatrixDimensions($operand2);
if (($matrix1Rows == $matrix2Columns) && ($matrix2Rows == $matrix1Columns)) { if (($matrix1Rows == $matrix2Columns) && ($matrix2Rows == $matrix1Columns)) {
$resize = 1; $resize = 1;
} }
@ -2873,7 +2873,7 @@ class PHPExcel_Calculation
* @param mixed &$matrix matrix operand * @param mixed &$matrix matrix operand
* @return array An array comprising the number of rows, and number of columns * @return array An array comprising the number of rows, and number of columns
*/ */
public static function _getMatrixDimensions(&$matrix) private static function getMatrixDimensions(&$matrix)
{ {
$matrixRows = count($matrix); $matrixRows = count($matrix);
$matrixColumns = 0; $matrixColumns = 0;

View File

@ -42,7 +42,7 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* *
* @var boolean * @var boolean
*/ */
protected $_preCalculateFormulas = true; protected $preCalculateFormulas = true;
/** /**
* Use disk caching where possible? * Use disk caching where possible?
@ -96,7 +96,7 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
*/ */
public function getPreCalculateFormulas() public function getPreCalculateFormulas()
{ {
return $this->_preCalculateFormulas; return $this->preCalculateFormulas;
} }
/** /**
@ -109,7 +109,7 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
*/ */
public function setPreCalculateFormulas($pValue = true) public function setPreCalculateFormulas($pValue = true)
{ {
$this->_preCalculateFormulas = (boolean) $pValue; $this->preCalculateFormulas = (boolean) $pValue;
return $this; return $this;
} }

View File

@ -126,9 +126,9 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
// Write rows to file // Write rows to file
for ($row = 1; $row <= $maxRow; ++$row) { for ($row = 1; $row <= $maxRow; ++$row) {
// Convert the row to an array... // Convert the row to an array...
$cellsArray = $sheet->rangeToArray('A'.$row.':'.$maxCol.$row, '', $this->_preCalculateFormulas); $cellsArray = $sheet->rangeToArray('A'.$row.':'.$maxCol.$row, '', $this->preCalculateFormulas);
// ... and write to the file // ... and write to the file
$this->_writeLine($fileHandle, $cellsArray[0]); $this->writeLine($fileHandle, $cellsArray[0]);
} }
// Close file // Close file
@ -281,7 +281,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
* @param array $pValues Array containing values in a row * @param array $pValues Array containing values in a row
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeLine($pFileHandle = null, $pValues = null) private function writeLine($pFileHandle = null, $pValues = null)
{ {
if (is_array($pValues)) { if (is_array($pValues)) {
// No leading delimiter // No leading delimiter

View File

@ -36,84 +36,84 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
* *
* @var boolean * @var boolean
*/ */
protected $_preCalculateFormulas = false; protected $preCalculateFormulas = false;
/** /**
* Office2003 compatibility * Office2003 compatibility
* *
* @var boolean * @var boolean
*/ */
private $_office2003compatibility = false; private $office2003compatibility = false;
/** /**
* Private writer parts * Private writer parts
* *
* @var PHPExcel_Writer_Excel2007_WriterPart[] * @var PHPExcel_Writer_Excel2007_WriterPart[]
*/ */
private $_writerParts = array(); private $writerParts = array();
/** /**
* Private PHPExcel * Private PHPExcel
* *
* @var PHPExcel * @var PHPExcel
*/ */
private $_spreadSheet; private $spreadSheet;
/** /**
* Private string table * Private string table
* *
* @var string[] * @var string[]
*/ */
private $_stringTable = array(); private $stringTable = array();
/** /**
* Private unique PHPExcel_Style_Conditional HashTable * Private unique PHPExcel_Style_Conditional HashTable
* *
* @var PHPExcel_HashTable * @var PHPExcel_HashTable
*/ */
private $_stylesConditionalHashTable; private $stylesConditionalHashTable;
/** /**
* Private unique PHPExcel_Style HashTable * Private unique PHPExcel_Style HashTable
* *
* @var PHPExcel_HashTable * @var PHPExcel_HashTable
*/ */
private $_styleHashTable; private $styleHashTable;
/** /**
* Private unique PHPExcel_Style_Fill HashTable * Private unique PHPExcel_Style_Fill HashTable
* *
* @var PHPExcel_HashTable * @var PHPExcel_HashTable
*/ */
private $_fillHashTable; private $fillHashTable;
/** /**
* Private unique PHPExcel_Style_Font HashTable * Private unique PHPExcel_Style_Font HashTable
* *
* @var PHPExcel_HashTable * @var PHPExcel_HashTable
*/ */
private $_fontHashTable; private $fontHashTable;
/** /**
* Private unique PHPExcel_Style_Borders HashTable * Private unique PHPExcel_Style_Borders HashTable
* *
* @var PHPExcel_HashTable * @var PHPExcel_HashTable
*/ */
private $_bordersHashTable ; private $bordersHashTable ;
/** /**
* Private unique PHPExcel_Style_NumberFormat HashTable * Private unique PHPExcel_Style_NumberFormat HashTable
* *
* @var PHPExcel_HashTable * @var PHPExcel_HashTable
*/ */
private $_numFmtHashTable; private $numFmtHashTable;
/** /**
* Private unique PHPExcel_Worksheet_BaseDrawing HashTable * Private unique PHPExcel_Worksheet_BaseDrawing HashTable
* *
* @var PHPExcel_HashTable * @var PHPExcel_HashTable
*/ */
private $_drawingHashTable; private $drawingHashTable;
/** /**
* Create a new PHPExcel_Writer_Excel2007 * Create a new PHPExcel_Writer_Excel2007
@ -143,12 +143,12 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
// Initialise writer parts // Initialise writer parts
// and Assign their parent IWriters // and Assign their parent IWriters
foreach ($writerPartsArray as $writer => $class) { foreach ($writerPartsArray as $writer => $class) {
$this->_writerParts[$writer] = new $class($this); $this->writerParts[$writer] = new $class($this);
} }
$hashTablesArray = array( '_stylesConditionalHashTable', '_fillHashTable', '_fontHashTable', $hashTablesArray = array( 'stylesConditionalHashTable', 'fillHashTable', 'fontHashTable',
'_bordersHashTable', '_numFmtHashTable', '_drawingHashTable', 'bordersHashTable', 'numFmtHashTable', 'drawingHashTable',
'_styleHashTable' 'styleHashTable'
); );
// Set HashTable variables // Set HashTable variables
@ -165,8 +165,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/ */
public function getWriterPart($pPartName = '') public function getWriterPart($pPartName = '')
{ {
if ($pPartName != '' && isset($this->_writerParts[strtolower($pPartName)])) { if ($pPartName != '' && isset($this->writerParts[strtolower($pPartName)])) {
return $this->_writerParts[strtolower($pPartName)]; return $this->writerParts[strtolower($pPartName)];
} else { } else {
return null; return null;
} }
@ -180,9 +180,9 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/ */
public function save($pFilename = null) public function save($pFilename = null)
{ {
if ($this->_spreadSheet !== null) { if ($this->spreadSheet !== null) {
// garbage collect // garbage collect
$this->_spreadSheet->garbageCollect(); $this->spreadSheet->garbageCollect();
// If $pFilename is php://output or php://stdout, make it a temporary file... // If $pFilename is php://output or php://stdout, make it a temporary file...
$originalFilename = $pFilename; $originalFilename = $pFilename;
@ -193,27 +193,27 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
} }
} }
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->getWriteDebugLog(); $saveDebugLog = PHPExcel_Calculation::getInstance($this->spreadSheet)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog(false); PHPExcel_Calculation::getInstance($this->spreadSheet)->getDebugLog()->setWriteDebugLog(false);
$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType(); $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Create string lookup table // Create string lookup table
$this->_stringTable = array(); $this->stringTable = array();
for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) { for ($i = 0; $i < $this->spreadSheet->getSheetCount(); ++$i) {
$this->_stringTable = $this->getWriterPart('StringTable')->createStringTable($this->_spreadSheet->getSheet($i), $this->_stringTable); $this->stringTable = $this->getWriterPart('StringTable')->createStringTable($this->spreadSheet->getSheet($i), $this->stringTable);
} }
// Create styles dictionaries // Create styles dictionaries
$this->_styleHashTable->addFromSource($this->getWriterPart('Style')->allStyles($this->_spreadSheet)); $this->styleHashTable->addFromSource($this->getWriterPart('Style')->allStyles($this->spreadSheet));
$this->_stylesConditionalHashTable->addFromSource($this->getWriterPart('Style')->allConditionalStyles($this->_spreadSheet)); $this->stylesConditionalHashTable->addFromSource($this->getWriterPart('Style')->allConditionalStyles($this->spreadSheet));
$this->_fillHashTable->addFromSource($this->getWriterPart('Style')->allFills($this->_spreadSheet)); $this->fillHashTable->addFromSource($this->getWriterPart('Style')->allFills($this->spreadSheet));
$this->_fontHashTable->addFromSource($this->getWriterPart('Style')->allFonts($this->_spreadSheet)); $this->fontHashTable->addFromSource($this->getWriterPart('Style')->allFonts($this->spreadSheet));
$this->_bordersHashTable->addFromSource($this->getWriterPart('Style')->allBorders($this->_spreadSheet)); $this->bordersHashTable->addFromSource($this->getWriterPart('Style')->allBorders($this->spreadSheet));
$this->_numFmtHashTable->addFromSource($this->getWriterPart('Style')->allNumberFormats($this->_spreadSheet)); $this->numFmtHashTable->addFromSource($this->getWriterPart('Style')->allNumberFormats($this->spreadSheet));
// Create drawing dictionary // Create drawing dictionary
$this->_drawingHashTable->addFromSource($this->getWriterPart('Drawing')->allDrawings($this->_spreadSheet)); $this->drawingHashTable->addFromSource($this->getWriterPart('Drawing')->allDrawings($this->spreadSheet));
// Create new ZIP file and open it for writing // Create new ZIP file and open it for writing
$zipClass = PHPExcel_Settings::getZipClass(); $zipClass = PHPExcel_Settings::getZipClass();
@ -236,65 +236,65 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
} }
// Add [Content_Types].xml to ZIP file // Add [Content_Types].xml to ZIP file
$objZip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->_spreadSheet, $this->includeCharts)); $objZip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->spreadSheet, $this->includeCharts));
//if hasMacros, add the vbaProject.bin file, Certificate file(if exists) //if hasMacros, add the vbaProject.bin file, Certificate file(if exists)
if ($this->_spreadSheet->hasMacros()) { if ($this->spreadSheet->hasMacros()) {
$macrosCode=$this->_spreadSheet->getMacrosCode(); $macrosCode=$this->spreadSheet->getMacrosCode();
if (!is_null($macrosCode)) {// we have the code ? if (!is_null($macrosCode)) {// we have the code ?
$objZip->addFromString('xl/vbaProject.bin', $macrosCode);//allways in 'xl', allways named vbaProject.bin $objZip->addFromString('xl/vbaProject.bin', $macrosCode);//allways in 'xl', allways named vbaProject.bin
if ($this->_spreadSheet->hasMacrosCertificate()) {//signed macros ? if ($this->spreadSheet->hasMacrosCertificate()) {//signed macros ?
// Yes : add the certificate file and the related rels file // Yes : add the certificate file and the related rels file
$objZip->addFromString('xl/vbaProjectSignature.bin', $this->_spreadSheet->getMacrosCertificate()); $objZip->addFromString('xl/vbaProjectSignature.bin', $this->spreadSheet->getMacrosCertificate());
$objZip->addFromString('xl/_rels/vbaProject.bin.rels', $this->getWriterPart('RelsVBA')->writeVBARelationships($this->_spreadSheet)); $objZip->addFromString('xl/_rels/vbaProject.bin.rels', $this->getWriterPart('RelsVBA')->writeVBARelationships($this->spreadSheet));
} }
} }
} }
//a custom UI in this workbook ? add it ("base" xml and additional objects (pictures) and rels) //a custom UI in this workbook ? add it ("base" xml and additional objects (pictures) and rels)
if ($this->_spreadSheet->hasRibbon()) { if ($this->spreadSheet->hasRibbon()) {
$tmpRibbonTarget=$this->_spreadSheet->getRibbonXMLData('target'); $tmpRibbonTarget=$this->spreadSheet->getRibbonXMLData('target');
$objZip->addFromString($tmpRibbonTarget, $this->_spreadSheet->getRibbonXMLData('data')); $objZip->addFromString($tmpRibbonTarget, $this->spreadSheet->getRibbonXMLData('data'));
if ($this->_spreadSheet->hasRibbonBinObjects()) { if ($this->spreadSheet->hasRibbonBinObjects()) {
$tmpRootPath=dirname($tmpRibbonTarget).'/'; $tmpRootPath=dirname($tmpRibbonTarget).'/';
$ribbonBinObjects=$this->_spreadSheet->getRibbonBinObjects('data');//the files to write $ribbonBinObjects=$this->spreadSheet->getRibbonBinObjects('data');//the files to write
foreach ($ribbonBinObjects as $aPath => $aContent) { foreach ($ribbonBinObjects as $aPath => $aContent) {
$objZip->addFromString($tmpRootPath.$aPath, $aContent); $objZip->addFromString($tmpRootPath.$aPath, $aContent);
} }
//the rels for files //the rels for files
$objZip->addFromString($tmpRootPath.'_rels/'.basename($tmpRibbonTarget).'.rels', $this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->_spreadSheet)); $objZip->addFromString($tmpRootPath.'_rels/'.basename($tmpRibbonTarget).'.rels', $this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->spreadSheet));
} }
} }
// Add relationships to ZIP file // Add relationships to ZIP file
$objZip->addFromString('_rels/.rels', $this->getWriterPart('Rels')->writeRelationships($this->_spreadSheet)); $objZip->addFromString('_rels/.rels', $this->getWriterPart('Rels')->writeRelationships($this->spreadSheet));
$objZip->addFromString('xl/_rels/workbook.xml.rels', $this->getWriterPart('Rels')->writeWorkbookRelationships($this->_spreadSheet)); $objZip->addFromString('xl/_rels/workbook.xml.rels', $this->getWriterPart('Rels')->writeWorkbookRelationships($this->spreadSheet));
// Add document properties to ZIP file // Add document properties to ZIP file
$objZip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->writeDocPropsApp($this->_spreadSheet)); $objZip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->writeDocPropsApp($this->spreadSheet));
$objZip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->writeDocPropsCore($this->_spreadSheet)); $objZip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->writeDocPropsCore($this->spreadSheet));
$customPropertiesPart = $this->getWriterPart('DocProps')->writeDocPropsCustom($this->_spreadSheet); $customPropertiesPart = $this->getWriterPart('DocProps')->writeDocPropsCustom($this->spreadSheet);
if ($customPropertiesPart !== null) { if ($customPropertiesPart !== null) {
$objZip->addFromString('docProps/custom.xml', $customPropertiesPart); $objZip->addFromString('docProps/custom.xml', $customPropertiesPart);
} }
// Add theme to ZIP file // Add theme to ZIP file
$objZip->addFromString('xl/theme/theme1.xml', $this->getWriterPart('Theme')->writeTheme($this->_spreadSheet)); $objZip->addFromString('xl/theme/theme1.xml', $this->getWriterPart('Theme')->writeTheme($this->spreadSheet));
// Add string table to ZIP file // Add string table to ZIP file
$objZip->addFromString('xl/sharedStrings.xml', $this->getWriterPart('StringTable')->writeStringTable($this->_stringTable)); $objZip->addFromString('xl/sharedStrings.xml', $this->getWriterPart('StringTable')->writeStringTable($this->stringTable));
// Add styles to ZIP file // Add styles to ZIP file
$objZip->addFromString('xl/styles.xml', $this->getWriterPart('Style')->writeStyles($this->_spreadSheet)); $objZip->addFromString('xl/styles.xml', $this->getWriterPart('Style')->writeStyles($this->spreadSheet));
// Add workbook to ZIP file // Add workbook to ZIP file
$objZip->addFromString('xl/workbook.xml', $this->getWriterPart('Workbook')->writeWorkbook($this->_spreadSheet, $this->_preCalculateFormulas)); $objZip->addFromString('xl/workbook.xml', $this->getWriterPart('Workbook')->writeWorkbook($this->spreadSheet, $this->preCalculateFormulas));
$chartCount = 0; $chartCount = 0;
// Add worksheets // Add worksheets
for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) { for ($i = 0; $i < $this->spreadSheet->getSheetCount(); ++$i) {
$objZip->addFromString('xl/worksheets/sheet' . ($i + 1) . '.xml', $this->getWriterPart('Worksheet')->writeWorksheet($this->_spreadSheet->getSheet($i), $this->_stringTable, $this->includeCharts)); $objZip->addFromString('xl/worksheets/sheet' . ($i + 1) . '.xml', $this->getWriterPart('Worksheet')->writeWorksheet($this->spreadSheet->getSheet($i), $this->stringTable, $this->includeCharts));
if ($this->includeCharts) { if ($this->includeCharts) {
$charts = $this->_spreadSheet->getSheet($i)->getChartCollection(); $charts = $this->spreadSheet->getSheet($i)->getChartCollection();
if (count($charts) > 0) { if (count($charts) > 0) {
foreach ($charts as $chart) { foreach ($charts as $chart) {
$objZip->addFromString('xl/charts/chart' . ($chartCount + 1) . '.xml', $this->getWriterPart('Chart')->writeChart($chart)); $objZip->addFromString('xl/charts/chart' . ($chartCount + 1) . '.xml', $this->getWriterPart('Chart')->writeChart($chart));
@ -306,44 +306,44 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
$chartRef1 = $chartRef2 = 0; $chartRef1 = $chartRef2 = 0;
// Add worksheet relationships (drawings, ...) // Add worksheet relationships (drawings, ...)
for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) { for ($i = 0; $i < $this->spreadSheet->getSheetCount(); ++$i) {
// Add relationships // Add relationships
$objZip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->_spreadSheet->getSheet($i), ($i + 1), $this->includeCharts)); $objZip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->spreadSheet->getSheet($i), ($i + 1), $this->includeCharts));
$drawings = $this->_spreadSheet->getSheet($i)->getDrawingCollection(); $drawings = $this->spreadSheet->getSheet($i)->getDrawingCollection();
$drawingCount = count($drawings); $drawingCount = count($drawings);
if ($this->includeCharts) { if ($this->includeCharts) {
$chartCount = $this->_spreadSheet->getSheet($i)->getChartCount(); $chartCount = $this->spreadSheet->getSheet($i)->getChartCount();
} }
// Add drawing and image relationship parts // Add drawing and image relationship parts
if (($drawingCount > 0) || ($chartCount > 0)) { if (($drawingCount > 0) || ($chartCount > 0)) {
// Drawing relationships // Drawing relationships
$objZip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->_spreadSheet->getSheet($i), $chartRef1, $this->includeCharts)); $objZip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->spreadSheet->getSheet($i), $chartRef1, $this->includeCharts));
// Drawings // Drawings
$objZip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->_spreadSheet->getSheet($i), $chartRef2, $this->includeCharts)); $objZip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->spreadSheet->getSheet($i), $chartRef2, $this->includeCharts));
} }
// Add comment relationship parts // Add comment relationship parts
if (count($this->_spreadSheet->getSheet($i)->getComments()) > 0) { if (count($this->spreadSheet->getSheet($i)->getComments()) > 0) {
// VML Comments // VML Comments
$objZip->addFromString('xl/drawings/vmlDrawing' . ($i + 1) . '.vml', $this->getWriterPart('Comments')->writeVMLComments($this->_spreadSheet->getSheet($i))); $objZip->addFromString('xl/drawings/vmlDrawing' . ($i + 1) . '.vml', $this->getWriterPart('Comments')->writeVMLComments($this->spreadSheet->getSheet($i)));
// Comments // Comments
$objZip->addFromString('xl/comments' . ($i + 1) . '.xml', $this->getWriterPart('Comments')->writeComments($this->_spreadSheet->getSheet($i))); $objZip->addFromString('xl/comments' . ($i + 1) . '.xml', $this->getWriterPart('Comments')->writeComments($this->spreadSheet->getSheet($i)));
} }
// Add header/footer relationship parts // Add header/footer relationship parts
if (count($this->_spreadSheet->getSheet($i)->getHeaderFooter()->getImages()) > 0) { if (count($this->spreadSheet->getSheet($i)->getHeaderFooter()->getImages()) > 0) {
// VML Drawings // VML Drawings
$objZip->addFromString('xl/drawings/vmlDrawingHF' . ($i + 1) . '.vml', $this->getWriterPart('Drawing')->writeVMLHeaderFooterImages($this->_spreadSheet->getSheet($i))); $objZip->addFromString('xl/drawings/vmlDrawingHF' . ($i + 1) . '.vml', $this->getWriterPart('Drawing')->writeVMLHeaderFooterImages($this->spreadSheet->getSheet($i)));
// VML Drawing relationships // VML Drawing relationships
$objZip->addFromString('xl/drawings/_rels/vmlDrawingHF' . ($i + 1) . '.vml.rels', $this->getWriterPart('Rels')->writeHeaderFooterDrawingRelationships($this->_spreadSheet->getSheet($i))); $objZip->addFromString('xl/drawings/_rels/vmlDrawingHF' . ($i + 1) . '.vml.rels', $this->getWriterPart('Rels')->writeHeaderFooterDrawingRelationships($this->spreadSheet->getSheet($i)));
// Media // Media
foreach ($this->_spreadSheet->getSheet($i)->getHeaderFooter()->getImages() as $image) { foreach ($this->spreadSheet->getSheet($i)->getHeaderFooter()->getImages() as $image) {
$objZip->addFromString('xl/media/' . $image->getIndexedFilename(), file_get_contents($image->getPath())); $objZip->addFromString('xl/media/' . $image->getIndexedFilename(), file_get_contents($image->getPath()));
} }
} }
@ -382,7 +382,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
} }
PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType); PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType);
PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog($saveDebugLog); PHPExcel_Calculation::getInstance($this->spreadSheet)->getDebugLog()->setWriteDebugLog($saveDebugLog);
// Close file // Close file
if ($objZip->close() === false) { if ($objZip->close() === false) {
@ -409,10 +409,10 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/ */
public function getPHPExcel() public function getPHPExcel()
{ {
if ($this->_spreadSheet !== null) { if ($this->spreadSheet !== null) {
return $this->_spreadSheet; return $this->spreadSheet;
} else { } else {
throw new PHPExcel_Writer_Exception("No PHPExcel assigned."); throw new PHPExcel_Writer_Exception("No PHPExcel object assigned.");
} }
} }
@ -425,7 +425,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/ */
public function setPHPExcel(PHPExcel $pPHPExcel = null) public function setPHPExcel(PHPExcel $pPHPExcel = null)
{ {
$this->_spreadSheet = $pPHPExcel; $this->spreadSheet = $pPHPExcel;
return $this; return $this;
} }
@ -436,7 +436,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/ */
public function getStringTable() public function getStringTable()
{ {
return $this->_stringTable; return $this->stringTable;
} }
/** /**
@ -446,7 +446,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/ */
public function getStyleHashTable() public function getStyleHashTable()
{ {
return $this->_styleHashTable; return $this->styleHashTable;
} }
/** /**
@ -456,7 +456,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/ */
public function getStylesConditionalHashTable() public function getStylesConditionalHashTable()
{ {
return $this->_stylesConditionalHashTable; return $this->stylesConditionalHashTable;
} }
/** /**
@ -466,7 +466,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/ */
public function getFillHashTable() public function getFillHashTable()
{ {
return $this->_fillHashTable; return $this->fillHashTable;
} }
/** /**
@ -476,7 +476,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/ */
public function getFontHashTable() public function getFontHashTable()
{ {
return $this->_fontHashTable; return $this->fontHashTable;
} }
/** /**
@ -486,7 +486,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/ */
public function getBordersHashTable() public function getBordersHashTable()
{ {
return $this->_bordersHashTable; return $this->bordersHashTable;
} }
/** /**
@ -496,7 +496,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/ */
public function getNumFmtHashTable() public function getNumFmtHashTable()
{ {
return $this->_numFmtHashTable; return $this->numFmtHashTable;
} }
/** /**
@ -506,7 +506,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/ */
public function getDrawingHashTable() public function getDrawingHashTable()
{ {
return $this->_drawingHashTable; return $this->drawingHashTable;
} }
/** /**
@ -516,7 +516,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/ */
public function getOffice2003Compatibility() public function getOffice2003Compatibility()
{ {
return $this->_office2003compatibility; return $this->office2003compatibility;
} }
/** /**
@ -527,7 +527,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
*/ */
public function setOffice2003Compatibility($pValue = false) public function setOffice2003Compatibility($pValue = false)
{ {
$this->_office2003compatibility = $pValue; $this->office2003compatibility = $pValue;
return $this; return $this;
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Writer_Excel2007_Chart
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,14 +25,6 @@
* @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##
*/ */
/**
* PHPExcel_Writer_Excel2007_Chart
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart
{ {
/** /**
@ -73,19 +66,19 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->writeAttribute('val', 0); $objWriter->writeAttribute('val', 0);
$objWriter->endElement(); $objWriter->endElement();
$this->_writeAlternateContent($objWriter); $this->writeAlternateContent($objWriter);
$objWriter->startElement('c:chart'); $objWriter->startElement('c:chart');
$this->_writeTitle($pChart->getTitle(), $objWriter); $this->writeTitle($pChart->getTitle(), $objWriter);
$objWriter->startElement('c:autoTitleDeleted'); $objWriter->startElement('c:autoTitleDeleted');
$objWriter->writeAttribute('val', 0); $objWriter->writeAttribute('val', 0);
$objWriter->endElement(); $objWriter->endElement();
$this->_writePlotArea($pChart->getPlotArea(), $pChart->getXAxisLabel(), $pChart->getYAxisLabel(), $objWriter, $pChart->getWorksheet(), $pChart->getChartAxisX(), $pChart->getChartAxisY(), $pChart->getMajorGridlines(), $pChart->getMinorGridlines()); $this->writePlotArea($pChart->getPlotArea(), $pChart->getXAxisLabel(), $pChart->getYAxisLabel(), $objWriter, $pChart->getWorksheet(), $pChart->getChartAxisX(), $pChart->getChartAxisY(), $pChart->getMajorGridlines(), $pChart->getMinorGridlines());
$this->_writeLegend($pChart->getLegend(), $objWriter); $this->writeLegend($pChart->getLegend(), $objWriter);
$objWriter->startElement('c:plotVisOnly'); $objWriter->startElement('c:plotVisOnly');
$objWriter->writeAttribute('val', 1); $objWriter->writeAttribute('val', 1);
@ -101,7 +94,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->endElement(); $objWriter->endElement();
$this->_writePrintSettings($objWriter); $this->writePrintSettings($objWriter);
$objWriter->endElement(); $objWriter->endElement();
@ -117,7 +110,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter) private function writeTitle(PHPExcel_Chart_Title $title = null, $objWriter)
{ {
if (is_null($title)) { if (is_null($title)) {
return; return;
@ -145,7 +138,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->endElement(); $objWriter->endElement();
$objWriter->endElement(); $objWriter->endElement();
$this->_writeLayout($title->getLayout(), $objWriter); $this->writeLayout($title->getLayout(), $objWriter);
$objWriter->startElement('c:overlay'); $objWriter->startElement('c:overlay');
$objWriter->writeAttribute('val', 0); $objWriter->writeAttribute('val', 0);
@ -162,7 +155,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter) private function writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter)
{ {
if (is_null($legend)) { if (is_null($legend)) {
return; return;
@ -174,7 +167,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->writeAttribute('val', $legend->getPosition()); $objWriter->writeAttribute('val', $legend->getPosition());
$objWriter->endElement(); $objWriter->endElement();
$this->_writeLayout($legend->getLayout(), $objWriter); $this->writeLayout($legend->getLayout(), $objWriter);
$objWriter->startElement('c:overlay'); $objWriter->startElement('c:overlay');
$objWriter->writeAttribute('val', ($legend->getOverlay()) ? '1' : '0'); $objWriter->writeAttribute('val', ($legend->getOverlay()) ? '1' : '0');
@ -217,7 +210,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, $objWriter, PHPExcel_Worksheet $pSheet, PHPExcel_Chart_Axis $xAxis, PHPExcel_Chart_Axis $yAxis, PHPExcel_Chart_GridLines $majorGridlines, PHPExcel_Chart_GridLines $minorGridlines) private function writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, $objWriter, PHPExcel_Worksheet $pSheet, PHPExcel_Chart_Axis $xAxis, PHPExcel_Chart_Axis $yAxis, PHPExcel_Chart_GridLines $majorGridlines, PHPExcel_Chart_GridLines $minorGridlines)
{ {
if (is_null($plotArea)) { if (is_null($plotArea)) {
return; return;
@ -229,9 +222,9 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$layout = $plotArea->getLayout(); $layout = $plotArea->getLayout();
$this->_writeLayout($layout, $objWriter); $this->writeLayout($layout, $objWriter);
$chartTypes = self::_getChartType($plotArea); $chartTypes = self::getChartType($plotArea);
$catIsMultiLevelSeries = $valIsMultiLevelSeries = false; $catIsMultiLevelSeries = $valIsMultiLevelSeries = false;
$plotGroupingType = ''; $plotGroupingType = '';
foreach ($chartTypes as $chartType) { foreach ($chartTypes as $chartType) {
@ -253,11 +246,11 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->endElement(); $objWriter->endElement();
} }
$this->_writePlotGroup($plotGroup, $chartType, $objWriter, $catIsMultiLevelSeries, $valIsMultiLevelSeries, $plotGroupingType, $pSheet); $this->writePlotGroup($plotGroup, $chartType, $objWriter, $catIsMultiLevelSeries, $valIsMultiLevelSeries, $plotGroupingType, $pSheet);
} }
} }
$this->_writeDataLbls($objWriter, $layout); $this->writeDataLabels($objWriter, $layout);
if ($chartType === PHPExcel_Chart_DataSeries::TYPE_LINECHART) { if ($chartType === PHPExcel_Chart_DataSeries::TYPE_LINECHART) {
// Line only, Line3D can't be smoothed // Line only, Line3D can't be smoothed
@ -334,12 +327,12 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) { if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
if ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { if ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$this->_writeValAx($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines); $this->writeValueAxis($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines);
} else { } else {
$this->_writeCatAx($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis); $this->writeCategoryAxis($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis);
} }
$this->_writeValAx($objWriter, $plotArea, $yAxisLabel, $chartType, $id1, $id2, $valIsMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines); $this->writeValueAxis($objWriter, $plotArea, $yAxisLabel, $chartType, $id1, $id2, $valIsMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines);
} }
$objWriter->endElement(); $objWriter->endElement();
@ -353,7 +346,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeDataLbls($objWriter, $chartLayout) private function writeDataLabels($objWriter, $chartLayout)
{ {
$objWriter->startElement('c:dLbls'); $objWriter->startElement('c:dLbls');
@ -408,7 +401,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis) private function writeCategoryAxis($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis)
{ {
$objWriter->startElement('c:catAx'); $objWriter->startElement('c:catAx');
@ -461,7 +454,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->endElement(); $objWriter->endElement();
$layout = $xAxisLabel->getLayout(); $layout = $xAxisLabel->getLayout();
$this->_writeLayout($layout, $objWriter); $this->writeLayout($layout, $objWriter);
$objWriter->startElement('c:overlay'); $objWriter->startElement('c:overlay');
$objWriter->writeAttribute('val', 0); $objWriter->writeAttribute('val', 0);
@ -530,7 +523,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeValAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines) private function writeValueAxis($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines)
{ {
$objWriter->startElement('c:valAx'); $objWriter->startElement('c:valAx');
@ -811,7 +804,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$layout = $yAxisLabel->getLayout(); $layout = $yAxisLabel->getLayout();
$this->_writeLayout($layout, $objWriter); $this->writeLayout($layout, $objWriter);
} }
$objWriter->startElement('c:overlay'); $objWriter->startElement('c:overlay');
@ -1011,7 +1004,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* @return string|array * @return string|array
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private static function _getChartType($plotArea) private static function getChartType($plotArea)
{ {
$groupCount = $plotArea->getPlotGroupCount(); $groupCount = $plotArea->getPlotGroupCount();
@ -1044,7 +1037,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet) private function writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet)
{ {
if (is_null($plotGroup)) { if (is_null($plotGroup)) {
return; return;
@ -1117,7 +1110,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
if ($plotSeriesLabel && ($plotSeriesLabel->getPointCount() > 0)) { if ($plotSeriesLabel && ($plotSeriesLabel->getPointCount() > 0)) {
$objWriter->startElement('c:tx'); $objWriter->startElement('c:tx');
$objWriter->startElement('c:strRef'); $objWriter->startElement('c:strRef');
$this->_writePlotSeriesLabel($plotSeriesLabel, $objWriter); $this->writePlotSeriesLabel($plotSeriesLabel, $objWriter);
$objWriter->endElement(); $objWriter->endElement();
$objWriter->endElement(); $objWriter->endElement();
} }
@ -1182,7 +1175,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->startElement('c:cat'); $objWriter->startElement('c:cat');
} }
$this->_writePlotSeriesValues($plotSeriesCategory, $objWriter, $groupType, 'str', $pSheet); $this->writePlotSeriesValues($plotSeriesCategory, $objWriter, $groupType, 'str', $pSheet);
$objWriter->endElement(); $objWriter->endElement();
} }
@ -1196,12 +1189,12 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->startElement('c:val'); $objWriter->startElement('c:val');
} }
$this->_writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, 'num', $pSheet); $this->writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, 'num', $pSheet);
$objWriter->endElement(); $objWriter->endElement();
} }
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
$this->_writeBubbles($plotSeriesValues, $objWriter, $pSheet); $this->writeBubbles($plotSeriesValues, $objWriter, $pSheet);
} }
$objWriter->endElement(); $objWriter->endElement();
@ -1218,7 +1211,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePlotSeriesLabel($plotSeriesLabel, $objWriter) private function writePlotSeriesLabel($plotSeriesLabel, $objWriter)
{ {
if (is_null($plotSeriesLabel)) { if (is_null($plotSeriesLabel)) {
return; return;
@ -1256,7 +1249,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet) private function writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet)
{ {
if (is_null($plotSeriesValues)) { if (is_null($plotSeriesValues)) {
return; return;
@ -1348,7 +1341,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet) private function writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet)
{ {
if (is_null($plotSeriesValues)) { if (is_null($plotSeriesValues)) {
return; return;
@ -1395,7 +1388,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter) private function writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter)
{ {
$objWriter->startElement('c:layout'); $objWriter->startElement('c:layout');
@ -1464,7 +1457,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeAlternateContent($objWriter) private function writeAlternateContent($objWriter)
{ {
$objWriter->startElement('mc:AlternateContent'); $objWriter->startElement('mc:AlternateContent');
$objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006'); $objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006');
@ -1494,7 +1487,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePrintSettings($objWriter) private function writePrintSettings($objWriter)
{ {
$objWriter->startElement('c:printSettings'); $objWriter->startElement('c:printSettings');

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Writer_Excel2007_Comments
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @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##
*/ */
/**
* PHPExcel_Writer_Excel2007_Comments
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_WriterPart class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_WriterPart
{ {
/** /**

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Writer_Excel2007_ContentTypes
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @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##
*/ */
/**
* PHPExcel_Writer_Excel2007_ContentTypes
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_WriterPart class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_WriterPart
{ {
/** /**
@ -61,52 +53,52 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types'); $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types');
// Theme // Theme
$this->_writeOverrideContentType($objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml'); $this->writeOverrideContentType($objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml');
// Styles // Styles
$this->_writeOverrideContentType($objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml'); $this->writeOverrideContentType($objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml');
// Rels // Rels
$this->_writeDefaultContentType($objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml'); $this->writeDefaultContentType($objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml');
// XML // XML
$this->_writeDefaultContentType($objWriter, 'xml', 'application/xml'); $this->writeDefaultContentType($objWriter, 'xml', 'application/xml');
// VML // VML
$this->_writeDefaultContentType($objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'); $this->writeDefaultContentType($objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing');
// Workbook // Workbook
if ($pPHPExcel->hasMacros()) { //Macros in workbook ? if ($pPHPExcel->hasMacros()) { //Macros in workbook ?
// Yes : not standard content but "macroEnabled" // Yes : not standard content but "macroEnabled"
$this->_writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.ms-excel.sheet.macroEnabled.main+xml'); $this->writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.ms-excel.sheet.macroEnabled.main+xml');
//... and define a new type for the VBA project //... and define a new type for the VBA project
$this->_writeDefaultContentType($objWriter, 'bin', 'application/vnd.ms-office.vbaProject'); $this->writeDefaultContentType($objWriter, 'bin', 'application/vnd.ms-office.vbaProject');
if ($pPHPExcel->hasMacrosCertificate()) {// signed macros ? if ($pPHPExcel->hasMacrosCertificate()) {// signed macros ?
// Yes : add needed information // Yes : add needed information
$this->_writeOverrideContentType($objWriter, '/xl/vbaProjectSignature.bin', 'application/vnd.ms-office.vbaProjectSignature'); $this->writeOverrideContentType($objWriter, '/xl/vbaProjectSignature.bin', 'application/vnd.ms-office.vbaProjectSignature');
} }
} else {// no macros in workbook, so standard type } else {// no macros in workbook, so standard type
$this->_writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'); $this->writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml');
} }
// DocProps // DocProps
$this->_writeOverrideContentType($objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml'); $this->writeOverrideContentType($objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml');
$this->_writeOverrideContentType($objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml'); $this->writeOverrideContentType($objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml');
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties(); $customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
if (!empty($customPropertyList)) { if (!empty($customPropertyList)) {
$this->_writeOverrideContentType($objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml'); $this->writeOverrideContentType($objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml');
} }
// Worksheets // Worksheets
$sheetCount = $pPHPExcel->getSheetCount(); $sheetCount = $pPHPExcel->getSheetCount();
for ($i = 0; $i < $sheetCount; ++$i) { for ($i = 0; $i < $sheetCount; ++$i) {
$this->_writeOverrideContentType($objWriter, '/xl/worksheets/sheet' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml'); $this->writeOverrideContentType($objWriter, '/xl/worksheets/sheet' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml');
} }
// Shared strings // Shared strings
$this->_writeOverrideContentType($objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml'); $this->writeOverrideContentType($objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml');
// Add worksheet relationship content types // Add worksheet relationship content types
$chart = 1; $chart = 1;
@ -117,13 +109,13 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
// We need a drawing relationship for the worksheet if we have either drawings or charts // We need a drawing relationship for the worksheet if we have either drawings or charts
if (($drawingCount > 0) || ($chartCount > 0)) { if (($drawingCount > 0) || ($chartCount > 0)) {
$this->_writeOverrideContentType($objWriter, '/xl/drawings/drawing' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.drawing+xml'); $this->writeOverrideContentType($objWriter, '/xl/drawings/drawing' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.drawing+xml');
} }
// If we have charts, then we need a chart relationship for every individual chart // If we have charts, then we need a chart relationship for every individual chart
if ($chartCount > 0) { if ($chartCount > 0) {
for ($c = 0; $c < $chartCount; ++$c) { for ($c = 0; $c < $chartCount; ++$c) {
$this->_writeOverrideContentType($objWriter, '/xl/charts/chart' . $chart++ . '.xml', 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml'); $this->writeOverrideContentType($objWriter, '/xl/charts/chart' . $chart++ . '.xml', 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml');
} }
} }
} }
@ -131,7 +123,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
// Comments // Comments
for ($i = 0; $i < $sheetCount; ++$i) { for ($i = 0; $i < $sheetCount; ++$i) {
if (count($pPHPExcel->getSheet($i)->getComments()) > 0) { if (count($pPHPExcel->getSheet($i)->getComments()) > 0) {
$this->_writeOverrideContentType($objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml'); $this->writeOverrideContentType($objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml');
} }
} }
@ -144,7 +136,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) { if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension()); $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension());
$mimeType = $this->_getImageMimeType($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath()); $mimeType = $this->getImageMimeType($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath());
} elseif ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) { } elseif ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType()); $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType());
$extension = explode('/', $extension); $extension = explode('/', $extension);
@ -156,7 +148,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
if (!isset( $aMediaContentTypes[$extension])) { if (!isset( $aMediaContentTypes[$extension])) {
$aMediaContentTypes[$extension] = $mimeType; $aMediaContentTypes[$extension] = $mimeType;
$this->_writeDefaultContentType($objWriter, $extension, $mimeType); $this->writeDefaultContentType($objWriter, $extension, $mimeType);
} }
} }
if ($pPHPExcel->hasRibbonBinObjects()) { if ($pPHPExcel->hasRibbonBinObjects()) {
@ -165,7 +157,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
$tabRibbonTypes=array_diff($pPHPExcel->getRibbonBinObjects('types'), array_keys($aMediaContentTypes)); $tabRibbonTypes=array_diff($pPHPExcel->getRibbonBinObjects('types'), array_keys($aMediaContentTypes));
foreach ($tabRibbonTypes as $aRibbonType) { foreach ($tabRibbonTypes as $aRibbonType) {
$mimeType='image/.'.$aRibbonType;//we wrote $mimeType like customUI Editor $mimeType='image/.'.$aRibbonType;//we wrote $mimeType like customUI Editor
$this->_writeDefaultContentType($objWriter, $aRibbonType, $mimeType); $this->writeDefaultContentType($objWriter, $aRibbonType, $mimeType);
} }
} }
$sheetCount = $pPHPExcel->getSheetCount(); $sheetCount = $pPHPExcel->getSheetCount();
@ -173,9 +165,9 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) { if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) {
foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) { foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) {
if (!isset( $aMediaContentTypes[strtolower($image->getExtension())])) { if (!isset( $aMediaContentTypes[strtolower($image->getExtension())])) {
$aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType($image->getPath()); $aMediaContentTypes[strtolower($image->getExtension())] = $this->getImageMimeType($image->getPath());
$this->_writeDefaultContentType($objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]); $this->writeDefaultContentType($objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]);
} }
} }
} }
@ -194,7 +186,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
* @return string Mime Type * @return string Mime Type
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _getImageMimeType($pFile = '') private function getImageMimeType($pFile = '')
{ {
if (PHPExcel_Shared_File::file_exists($pFile)) { if (PHPExcel_Shared_File::file_exists($pFile)) {
$image = getimagesize($pFile); $image = getimagesize($pFile);
@ -212,7 +204,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
* @param string $pContentType Content type * @param string $pContentType Content type
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeDefaultContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') private function writeDefaultContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '')
{ {
if ($pPartname != '' && $pContentType != '') { if ($pPartname != '' && $pContentType != '') {
// Write content type // Write content type
@ -233,7 +225,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
* @param string $pContentType Content type * @param string $pContentType Content type
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeOverrideContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') private function writeOverrideContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '')
{ {
if ($pPartname != '' && $pContentType != '') { if ($pPartname != '' && $pContentType != '') {
// Write content type // Write content type

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Writer_Excel2007_DocProps
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @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##
*/ */
/**
* PHPExcel_Writer_Excel2007_DocProps
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_WriterPart class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_WriterPart
{ {
/** /**
@ -265,7 +257,6 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
$objWriter->endElement(); $objWriter->endElement();
// Return
return $objWriter->getData(); return $objWriter->getData();
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Writer_Excel2007_Drawing
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @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##
*/ */
/**
* PHPExcel_Writer_Excel2007_Drawing
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_WriterPart class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_WriterPart
{ {
/** /**

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Writer_Excel2007_Rels
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @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##
*/ */
/**
* PHPExcel_Writer_Excel2007_Rels
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPart class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPart
{ {
/** /**
@ -62,7 +54,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties(); $customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
if (!empty($customPropertyList)) { if (!empty($customPropertyList)) {
// Relationship docProps/app.xml // Relationship docProps/app.xml
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
4, 4,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties',
@ -72,7 +64,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
} }
// Relationship docProps/app.xml // Relationship docProps/app.xml
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
3, 3,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties',
@ -80,7 +72,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
); );
// Relationship docProps/core.xml // Relationship docProps/core.xml
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
2, 2,
'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties', 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties',
@ -88,7 +80,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
); );
// Relationship xl/workbook.xml // Relationship xl/workbook.xml
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
1, 1,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument',
@ -106,7 +98,6 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
$objWriter->endElement(); $objWriter->endElement();
// Return
return $objWriter->getData(); return $objWriter->getData();
} }
@ -135,7 +126,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
// Relationship styles.xml // Relationship styles.xml
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
1, 1,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles',
@ -143,7 +134,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
); );
// Relationship theme/theme1.xml // Relationship theme/theme1.xml
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
2, 2,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
@ -151,7 +142,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
); );
// Relationship sharedStrings.xml // Relationship sharedStrings.xml
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
3, 3,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings',
@ -161,7 +152,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
// Relationships with sheets // Relationships with sheets
$sheetCount = $pPHPExcel->getSheetCount(); $sheetCount = $pPHPExcel->getSheetCount();
for ($i = 0; $i < $sheetCount; ++$i) { for ($i = 0; $i < $sheetCount; ++$i) {
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
($i + 1 + 3), ($i + 1 + 3),
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet',
@ -182,7 +173,6 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
$objWriter->endElement(); $objWriter->endElement();
// Return
return $objWriter->getData(); return $objWriter->getData();
} }
@ -225,7 +215,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
} }
if (($pWorksheet->getDrawingCollection()->count() > 0) || if (($pWorksheet->getDrawingCollection()->count() > 0) ||
(count($charts) > 0)) { (count($charts) > 0)) {
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
++$d, ++$d,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing',
@ -239,7 +229,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
// echo 'Chart Rels: ' , count($charts) , '<br />'; // echo 'Chart Rels: ' , count($charts) , '<br />';
// if (count($charts) > 0) { // if (count($charts) > 0) {
// foreach ($charts as $chart) { // foreach ($charts as $chart) {
// $this->_writeRelationship( // $this->writeRelationship(
// $objWriter, // $objWriter,
// ++$d, // ++$d,
// 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', // 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart',
@ -252,7 +242,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
$i = 1; $i = 1;
foreach ($pWorksheet->getHyperlinkCollection() as $hyperlink) { foreach ($pWorksheet->getHyperlinkCollection() as $hyperlink) {
if (!$hyperlink->isInternal()) { if (!$hyperlink->isInternal()) {
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
'_hyperlink_' . $i, '_hyperlink_' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
@ -267,14 +257,14 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
// Write comments relationship? // Write comments relationship?
$i = 1; $i = 1;
if (count($pWorksheet->getComments()) > 0) { if (count($pWorksheet->getComments()) > 0) {
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
'_comments_vml' . $i, '_comments_vml' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
'../drawings/vmlDrawing' . $pWorksheetId . '.vml' '../drawings/vmlDrawing' . $pWorksheetId . '.vml'
); );
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
'_comments' . $i, '_comments' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments',
@ -285,7 +275,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
// Write header/footer relationship? // Write header/footer relationship?
$i = 1; $i = 1;
if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) { if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) {
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
'_headerfooter_vml' . $i, '_headerfooter_vml' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
@ -295,7 +285,6 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
$objWriter->endElement(); $objWriter->endElement();
// Return
return $objWriter->getData(); return $objWriter->getData();
} }
@ -332,7 +321,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
if ($iterator->current() instanceof PHPExcel_Worksheet_Drawing if ($iterator->current() instanceof PHPExcel_Worksheet_Drawing
|| $iterator->current() instanceof PHPExcel_Worksheet_MemoryDrawing) { || $iterator->current() instanceof PHPExcel_Worksheet_MemoryDrawing) {
// Write relationship for image drawing // Write relationship for image drawing
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
$i, $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
@ -349,7 +338,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
$chartCount = $pWorksheet->getChartCount(); $chartCount = $pWorksheet->getChartCount();
if ($chartCount > 0) { if ($chartCount > 0) {
for ($c = 0; $c < $chartCount; ++$c) { for ($c = 0; $c < $chartCount; ++$c) {
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
$i++, $i++,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart',
@ -361,7 +350,6 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
$objWriter->endElement(); $objWriter->endElement();
// Return
return $objWriter->getData(); return $objWriter->getData();
} }
@ -392,7 +380,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
// Loop through images and write relationships // Loop through images and write relationships
foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) { foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) {
// Write relationship for image drawing // Write relationship for image drawing
$this->_writeRelationship( $this->writeRelationship(
$objWriter, $objWriter,
$key, $key,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
@ -402,7 +390,6 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
$objWriter->endElement(); $objWriter->endElement();
// Return
return $objWriter->getData(); return $objWriter->getData();
} }
@ -416,7 +403,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
* @param string $pTargetMode Relationship target mode * @param string $pTargetMode Relationship target mode
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeRelationship(PHPExcel_Shared_XMLWriter $objWriter = null, $pId = 1, $pType = '', $pTarget = '', $pTargetMode = '') private function writeRelationship(PHPExcel_Shared_XMLWriter $objWriter = null, $pId = 1, $pType = '', $pTarget = '', $pTargetMode = '')
{ {
if ($pType != '' && $pTarget != '') { if ($pType != '' && $pTarget != '') {
// Write relationship // Write relationship

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Writer_Excel2007_RelsRibbon
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @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##
*/ */
/**
* PHPExcel_Writer_Excel2007_RelsRibbon
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_RelsRibbon extends PHPExcel_Writer_Excel2007_WriterPart class PHPExcel_Writer_Excel2007_RelsRibbon extends PHPExcel_Writer_Excel2007_WriterPart
{ {
/** /**
@ -65,12 +57,11 @@ class PHPExcel_Writer_Excel2007_RelsRibbon extends PHPExcel_Writer_Excel2007_Wri
$objWriter->writeAttribute('Id', $aId); $objWriter->writeAttribute('Id', $aId);
$objWriter->writeAttribute('Type', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image'); $objWriter->writeAttribute('Type', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image');
$objWriter->writeAttribute('Target', $aTarget); $objWriter->writeAttribute('Target', $aTarget);
$objWriter->endElement();//Relationship $objWriter->endElement();
} }
} }
$objWriter->endElement();//Relationships $objWriter->endElement();
// Return
return $objWriter->getData(); return $objWriter->getData();
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Writer_Excel2007_RelsVBA
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @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##
*/ */
/**
* PHPExcel_Writer_Excel2007_RelsVBA
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_RelsVBA extends PHPExcel_Writer_Excel2007_WriterPart class PHPExcel_Writer_Excel2007_RelsVBA extends PHPExcel_Writer_Excel2007_WriterPart
{ {
/** /**
@ -62,10 +54,9 @@ class PHPExcel_Writer_Excel2007_RelsVBA extends PHPExcel_Writer_Excel2007_Writer
$objWriter->writeAttribute('Id', 'rId1'); $objWriter->writeAttribute('Id', 'rId1');
$objWriter->writeAttribute('Type', 'http://schemas.microsoft.com/office/2006/relationships/vbaProjectSignature'); $objWriter->writeAttribute('Type', 'http://schemas.microsoft.com/office/2006/relationships/vbaProjectSignature');
$objWriter->writeAttribute('Target', 'vbaProjectSignature.bin'); $objWriter->writeAttribute('Target', 'vbaProjectSignature.bin');
$objWriter->endElement();//Relationship $objWriter->endElement();
$objWriter->endElement();//Relationships $objWriter->endElement();
// Return
return $objWriter->getData(); return $objWriter->getData();
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Writer_Excel2007_StringTable
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @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##
*/ */
/**
* PHPExcel_Writer_Excel2007_StringTable
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_WriterPart class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_WriterPart
{ {
/** /**
@ -78,7 +70,6 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
} }
} }
// Return
return $aStringTable; return $aStringTable;
} else { } else {
throw new PHPExcel_Writer_Exception("Invalid PHPExcel_Worksheet object passed."); throw new PHPExcel_Writer_Exception("Invalid PHPExcel_Worksheet object passed.");
@ -132,7 +123,6 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
$objWriter->endElement(); $objWriter->endElement();
// Return
return $objWriter->getData(); return $objWriter->getData();
} else { } else {
throw new PHPExcel_Writer_Exception("Invalid string table array passed."); throw new PHPExcel_Writer_Exception("Invalid string table array passed.");
@ -318,7 +308,6 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
} }
} }
// Return
return $returnValue; return $returnValue;
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Writer_Excel2007_Style
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @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##
*/ */
/**
* PHPExcel_Writer_Excel2007_Style
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPart class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPart
{ {
/** /**
@ -66,7 +58,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
// numFmt // numFmt
for ($i = 0; $i < $this->getParentWriter()->getNumFmtHashTable()->count(); ++$i) { for ($i = 0; $i < $this->getParentWriter()->getNumFmtHashTable()->count(); ++$i) {
$this->_writeNumFmt($objWriter, $this->getParentWriter()->getNumFmtHashTable()->getByIndex($i), $i); $this->writeNumFmt($objWriter, $this->getParentWriter()->getNumFmtHashTable()->getByIndex($i), $i);
} }
$objWriter->endElement(); $objWriter->endElement();
@ -77,7 +69,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
// font // font
for ($i = 0; $i < $this->getParentWriter()->getFontHashTable()->count(); ++$i) { for ($i = 0; $i < $this->getParentWriter()->getFontHashTable()->count(); ++$i) {
$this->_writeFont($objWriter, $this->getParentWriter()->getFontHashTable()->getByIndex($i)); $this->writeFont($objWriter, $this->getParentWriter()->getFontHashTable()->getByIndex($i));
} }
$objWriter->endElement(); $objWriter->endElement();
@ -88,7 +80,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
// fill // fill
for ($i = 0; $i < $this->getParentWriter()->getFillHashTable()->count(); ++$i) { for ($i = 0; $i < $this->getParentWriter()->getFillHashTable()->count(); ++$i) {
$this->_writeFill($objWriter, $this->getParentWriter()->getFillHashTable()->getByIndex($i)); $this->writeFill($objWriter, $this->getParentWriter()->getFillHashTable()->getByIndex($i));
} }
$objWriter->endElement(); $objWriter->endElement();
@ -99,7 +91,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
// border // border
for ($i = 0; $i < $this->getParentWriter()->getBordersHashTable()->count(); ++$i) { for ($i = 0; $i < $this->getParentWriter()->getBordersHashTable()->count(); ++$i) {
$this->_writeBorder($objWriter, $this->getParentWriter()->getBordersHashTable()->getByIndex($i)); $this->writeBorder($objWriter, $this->getParentWriter()->getBordersHashTable()->getByIndex($i));
} }
$objWriter->endElement(); $objWriter->endElement();
@ -124,7 +116,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
// xf // xf
foreach ($pPHPExcel->getCellXfCollection() as $cellXf) { foreach ($pPHPExcel->getCellXfCollection() as $cellXf) {
$this->_writeCellStyleXf($objWriter, $cellXf, $pPHPExcel); $this->writeCellStyleXf($objWriter, $cellXf, $pPHPExcel);
} }
$objWriter->endElement(); $objWriter->endElement();
@ -148,7 +140,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
// dxf // dxf
for ($i = 0; $i < $this->getParentWriter()->getStylesConditionalHashTable()->count(); ++$i) { for ($i = 0; $i < $this->getParentWriter()->getStylesConditionalHashTable()->count(); ++$i) {
$this->_writeCellStyleDxf($objWriter, $this->getParentWriter()->getStylesConditionalHashTable()->getByIndex($i)->getStyle()); $this->writeCellStyleDxf($objWriter, $this->getParentWriter()->getStylesConditionalHashTable()->getByIndex($i)->getStyle());
} }
$objWriter->endElement(); $objWriter->endElement();
@ -172,16 +164,16 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
* @param PHPExcel_Style_Fill $pFill Fill style * @param PHPExcel_Style_Fill $pFill Fill style
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) private function writeFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null)
{ {
// Check if this is a pattern type or gradient type // Check if this is a pattern type or gradient type
if ($pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR || if ($pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR ||
$pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_PATH) { $pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_PATH) {
// Gradient fill // Gradient fill
$this->_writeGradientFill($objWriter, $pFill); $this->writeGradientFill($objWriter, $pFill);
} elseif ($pFill->getFillType() !== null) { } elseif ($pFill->getFillType() !== null) {
// Pattern fill // Pattern fill
$this->_writePatternFill($objWriter, $pFill); $this->writePatternFill($objWriter, $pFill);
} }
} }
@ -192,7 +184,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
* @param PHPExcel_Style_Fill $pFill Fill style * @param PHPExcel_Style_Fill $pFill Fill style
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeGradientFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) private function writeGradientFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null)
{ {
// fill // fill
$objWriter->startElement('fill'); $objWriter->startElement('fill');
@ -236,7 +228,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
* @param PHPExcel_Style_Fill $pFill Fill style * @param PHPExcel_Style_Fill $pFill Fill style
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePatternFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) private function writePatternFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null)
{ {
// fill // fill
$objWriter->startElement('fill'); $objWriter->startElement('fill');
@ -274,7 +266,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
* @param PHPExcel_Style_Font $pFont Font style * @param PHPExcel_Style_Font $pFont Font style
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeFont(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Font $pFont = null) private function writeFont(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Font $pFont = null)
{ {
// font // font
$objWriter->startElement('font'); $objWriter->startElement('font');
@ -354,7 +346,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
* @param PHPExcel_Style_Borders $pBorders Borders style * @param PHPExcel_Style_Borders $pBorders Borders style
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeBorder(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Borders $pBorders = null) private function writeBorder(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Borders $pBorders = null)
{ {
// Write border // Write border
$objWriter->startElement('border'); $objWriter->startElement('border');
@ -375,11 +367,11 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
} }
// BorderPr // BorderPr
$this->_writeBorderPr($objWriter, 'left', $pBorders->getLeft()); $this->writeBorderPr($objWriter, 'left', $pBorders->getLeft());
$this->_writeBorderPr($objWriter, 'right', $pBorders->getRight()); $this->writeBorderPr($objWriter, 'right', $pBorders->getRight());
$this->_writeBorderPr($objWriter, 'top', $pBorders->getTop()); $this->writeBorderPr($objWriter, 'top', $pBorders->getTop());
$this->_writeBorderPr($objWriter, 'bottom', $pBorders->getBottom()); $this->writeBorderPr($objWriter, 'bottom', $pBorders->getBottom());
$this->_writeBorderPr($objWriter, 'diagonal', $pBorders->getDiagonal()); $this->writeBorderPr($objWriter, 'diagonal', $pBorders->getDiagonal());
$objWriter->endElement(); $objWriter->endElement();
} }
@ -391,7 +383,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
* @param PHPExcel $pPHPExcel Workbook * @param PHPExcel $pPHPExcel Workbook
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeCellStyleXf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null, PHPExcel $pPHPExcel = null) private function writeCellStyleXf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null, PHPExcel $pPHPExcel = null)
{ {
// xf // xf
$objWriter->startElement('xf'); $objWriter->startElement('xf');
@ -466,19 +458,19 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
* @param PHPExcel_Style $pStyle Style * @param PHPExcel_Style $pStyle Style
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeCellStyleDxf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null) private function writeCellStyleDxf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null)
{ {
// dxf // dxf
$objWriter->startElement('dxf'); $objWriter->startElement('dxf');
// font // font
$this->_writeFont($objWriter, $pStyle->getFont()); $this->writeFont($objWriter, $pStyle->getFont());
// numFmt // numFmt
$this->_writeNumFmt($objWriter, $pStyle->getNumberFormat()); $this->writeNumFmt($objWriter, $pStyle->getNumberFormat());
// fill // fill
$this->_writeFill($objWriter, $pStyle->getFill()); $this->writeFill($objWriter, $pStyle->getFill());
// alignment // alignment
$objWriter->startElement('alignment'); $objWriter->startElement('alignment');
@ -501,7 +493,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->endElement(); $objWriter->endElement();
// border // border
$this->_writeBorder($objWriter, $pStyle->getBorders()); $this->writeBorder($objWriter, $pStyle->getBorders());
// protection // protection
if (($pStyle->getProtection()->getLocked() !== null) || ($pStyle->getProtection()->getHidden() !== null)) { if (($pStyle->getProtection()->getLocked() !== null) || ($pStyle->getProtection()->getHidden() !== null)) {
@ -531,7 +523,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
* @param PHPExcel_Style_Border $pBorder Border style * @param PHPExcel_Style_Border $pBorder Border style
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeBorderPr(PHPExcel_Shared_XMLWriter $objWriter = null, $pName = 'left', PHPExcel_Style_Border $pBorder = null) private function writeBorderPr(PHPExcel_Shared_XMLWriter $objWriter = null, $pName = 'left', PHPExcel_Style_Border $pBorder = null)
{ {
// Write BorderPr // Write BorderPr
if ($pBorder->getBorderStyle() != PHPExcel_Style_Border::BORDER_NONE) { if ($pBorder->getBorderStyle() != PHPExcel_Style_Border::BORDER_NONE) {
@ -555,7 +547,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
* @param int $pId Number Format identifier * @param int $pId Number Format identifier
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeNumFmt(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_NumberFormat $pNumberFormat = null, $pId = 0) private function writeNumFmt(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_NumberFormat $pNumberFormat = null, $pId = 0)
{ {
// Translate formatcode // Translate formatcode
$formatCode = $pNumberFormat->getFormatCode(); $formatCode = $pNumberFormat->getFormatCode();

View File

@ -40,7 +40,7 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
* @static array of string * @static array of string
* *
*/ */
private static $_majorFonts = array( private static $majorFonts = array(
'Jpan' => ' Pゴシック', 'Jpan' => ' Pゴシック',
'Hang' => '맑은 고딕', 'Hang' => '맑은 고딕',
'Hans' => '宋体', 'Hans' => '宋体',
@ -78,7 +78,7 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
* @static array of string * @static array of string
* *
*/ */
private static $_minorFonts = array( private static $minorFonts = array(
'Jpan' => ' Pゴシック', 'Jpan' => ' Pゴシック',
'Hang' => '맑은 고딕', 'Hang' => '맑은 고딕',
'Hans' => '宋体', 'Hans' => '宋体',
@ -116,7 +116,7 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
* @static array of string * @static array of string
* *
*/ */
private static $_colourScheme = array( private static $colourScheme = array(
'dk2' => '1F497D', 'dk2' => '1F497D',
'lt2' => 'EEECE1', 'lt2' => 'EEECE1',
'accent1' => '4F81BD', 'accent1' => '4F81BD',
@ -184,7 +184,7 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
$objWriter->endElement(); $objWriter->endElement();
// a:dk2 // a:dk2
$this->_writeColourScheme($objWriter); $this->writeColourScheme($objWriter);
$objWriter->endElement(); $objWriter->endElement();
@ -194,12 +194,12 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
// a:majorFont // a:majorFont
$objWriter->startElement('a:majorFont'); $objWriter->startElement('a:majorFont');
$this->_writeFonts($objWriter, 'Cambria', self::$_majorFonts); $this->writeFonts($objWriter, 'Cambria', self::$majorFonts);
$objWriter->endElement(); $objWriter->endElement();
// a:minorFont // a:minorFont
$objWriter->startElement('a:minorFont'); $objWriter->startElement('a:minorFont');
$this->_writeFonts($objWriter, 'Calibri', self::$_minorFonts); $this->writeFonts($objWriter, 'Calibri', self::$minorFonts);
$objWriter->endElement(); $objWriter->endElement();
$objWriter->endElement(); $objWriter->endElement();
@ -822,7 +822,7 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
* @return string XML Output * @return string XML Output
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeFonts($objWriter, $latinFont, $fontSet) private function writeFonts($objWriter, $latinFont, $fontSet)
{ {
// a:latin // a:latin
$objWriter->startElement('a:latin'); $objWriter->startElement('a:latin');
@ -854,9 +854,9 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
* @return string XML Output * @return string XML Output
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeColourScheme($objWriter) private function writeColourScheme($objWriter)
{ {
foreach (self::$_colourScheme as $colourName => $colourValue) { foreach (self::$colourScheme as $colourName => $colourValue) {
$objWriter->startElement('a:'.$colourName); $objWriter->startElement('a:'.$colourName);
$objWriter->startElement('a:srgbClr'); $objWriter->startElement('a:srgbClr');

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Writer_Excel2007_Workbook
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @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##
*/ */
/**
* PHPExcel_Writer_Excel2007_Workbook
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_WriterPart class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_WriterPart
{ {
/** /**
@ -63,27 +55,27 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
// fileVersion // fileVersion
$this->_writeFileVersion($objWriter); $this->writeFileVersion($objWriter);
// workbookPr // workbookPr
$this->_writeWorkbookPr($objWriter); $this->writeWorkbookPr($objWriter);
// workbookProtection // workbookProtection
$this->_writeWorkbookProtection($objWriter, $pPHPExcel); $this->writeWorkbookProtection($objWriter, $pPHPExcel);
// bookViews // bookViews
if ($this->getParentWriter()->getOffice2003Compatibility() === false) { if ($this->getParentWriter()->getOffice2003Compatibility() === false) {
$this->_writeBookViews($objWriter, $pPHPExcel); $this->writeBookViews($objWriter, $pPHPExcel);
} }
// sheets // sheets
$this->_writeSheets($objWriter, $pPHPExcel); $this->writeSheets($objWriter, $pPHPExcel);
// definedNames // definedNames
$this->_writeDefinedNames($objWriter, $pPHPExcel); $this->writeDefinedNames($objWriter, $pPHPExcel);
// calcPr // calcPr
$this->_writeCalcPr($objWriter, $recalcRequired); $this->writeCalcPr($objWriter, $recalcRequired);
$objWriter->endElement(); $objWriter->endElement();
@ -97,7 +89,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeFileVersion(PHPExcel_Shared_XMLWriter $objWriter = null) private function writeFileVersion(PHPExcel_Shared_XMLWriter $objWriter = null)
{ {
$objWriter->startElement('fileVersion'); $objWriter->startElement('fileVersion');
$objWriter->writeAttribute('appName', 'xl'); $objWriter->writeAttribute('appName', 'xl');
@ -113,7 +105,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeWorkbookPr(PHPExcel_Shared_XMLWriter $objWriter = null) private function writeWorkbookPr(PHPExcel_Shared_XMLWriter $objWriter = null)
{ {
$objWriter->startElement('workbookPr'); $objWriter->startElement('workbookPr');
@ -133,7 +125,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @param PHPExcel $pPHPExcel * @param PHPExcel $pPHPExcel
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeBookViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) private function writeBookViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null)
{ {
// bookViews // bookViews
$objWriter->startElement('bookViews'); $objWriter->startElement('bookViews');
@ -163,7 +155,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @param PHPExcel $pPHPExcel * @param PHPExcel $pPHPExcel
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeWorkbookProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) private function writeWorkbookProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null)
{ {
if ($pPHPExcel->getSecurity()->isSecurityEnabled()) { if ($pPHPExcel->getSecurity()->isSecurityEnabled()) {
$objWriter->startElement('workbookProtection'); $objWriter->startElement('workbookProtection');
@ -190,7 +182,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing * @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null, $recalcRequired = true) private function writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null, $recalcRequired = true)
{ {
$objWriter->startElement('calcPr'); $objWriter->startElement('calcPr');
@ -213,14 +205,14 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @param PHPExcel $pPHPExcel * @param PHPExcel $pPHPExcel
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeSheets(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) private function writeSheets(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null)
{ {
// Write sheets // Write sheets
$objWriter->startElement('sheets'); $objWriter->startElement('sheets');
$sheetCount = $pPHPExcel->getSheetCount(); $sheetCount = $pPHPExcel->getSheetCount();
for ($i = 0; $i < $sheetCount; ++$i) { for ($i = 0; $i < $sheetCount; ++$i) {
// sheet // sheet
$this->_writeSheet( $this->writeSheet(
$objWriter, $objWriter,
$pPHPExcel->getSheet($i)->getTitle(), $pPHPExcel->getSheet($i)->getTitle(),
($i + 1), ($i + 1),
@ -242,7 +234,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @param string $sheetState Sheet state (visible, hidden, veryHidden) * @param string $sheetState Sheet state (visible, hidden, veryHidden)
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeSheet(PHPExcel_Shared_XMLWriter $objWriter = null, $pSheetname = '', $pSheetId = 1, $pRelId = 1, $sheetState = 'visible') private function writeSheet(PHPExcel_Shared_XMLWriter $objWriter = null, $pSheetname = '', $pSheetId = 1, $pRelId = 1, $sheetState = 'visible')
{ {
if ($pSheetname != '') { if ($pSheetname != '') {
// Write sheet // Write sheet
@ -266,7 +258,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @param PHPExcel $pPHPExcel * @param PHPExcel $pPHPExcel
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeDefinedNames(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) private function writeDefinedNames(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null)
{ {
// Write defined names // Write defined names
$objWriter->startElement('definedNames'); $objWriter->startElement('definedNames');
@ -274,20 +266,20 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
// Named ranges // Named ranges
if (count($pPHPExcel->getNamedRanges()) > 0) { if (count($pPHPExcel->getNamedRanges()) > 0) {
// Named ranges // Named ranges
$this->_writeNamedRanges($objWriter, $pPHPExcel); $this->writeNamedRanges($objWriter, $pPHPExcel);
} }
// Other defined names // Other defined names
$sheetCount = $pPHPExcel->getSheetCount(); $sheetCount = $pPHPExcel->getSheetCount();
for ($i = 0; $i < $sheetCount; ++$i) { for ($i = 0; $i < $sheetCount; ++$i) {
// definedName for autoFilter // definedName for autoFilter
$this->_writeDefinedNameForAutofilter($objWriter, $pPHPExcel->getSheet($i), $i); $this->writeDefinedNameForAutofilter($objWriter, $pPHPExcel->getSheet($i), $i);
// definedName for Print_Titles // definedName for Print_Titles
$this->_writeDefinedNameForPrintTitles($objWriter, $pPHPExcel->getSheet($i), $i); $this->writeDefinedNameForPrintTitles($objWriter, $pPHPExcel->getSheet($i), $i);
// definedName for Print_Area // definedName for Print_Area
$this->_writeDefinedNameForPrintArea($objWriter, $pPHPExcel->getSheet($i), $i); $this->writeDefinedNameForPrintArea($objWriter, $pPHPExcel->getSheet($i), $i);
} }
$objWriter->endElement(); $objWriter->endElement();
@ -300,12 +292,12 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @param PHPExcel $pPHPExcel * @param PHPExcel $pPHPExcel
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeNamedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel) private function writeNamedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel)
{ {
// Loop named ranges // Loop named ranges
$namedRanges = $pPHPExcel->getNamedRanges(); $namedRanges = $pPHPExcel->getNamedRanges();
foreach ($namedRanges as $namedRange) { foreach ($namedRanges as $namedRange) {
$this->_writeDefinedNameForNamedRange($objWriter, $namedRange); $this->writeDefinedNameForNamedRange($objWriter, $namedRange);
} }
} }
@ -316,7 +308,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @param PHPExcel_NamedRange $pNamedRange * @param PHPExcel_NamedRange $pNamedRange
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeDefinedNameForNamedRange(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_NamedRange $pNamedRange) private function writeDefinedNameForNamedRange(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_NamedRange $pNamedRange)
{ {
// definedName for named range // definedName for named range
$objWriter->startElement('definedName'); $objWriter->startElement('definedName');
@ -348,7 +340,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @param int $pSheetId * @param int $pSheetId
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeDefinedNameForAutofilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) private function writeDefinedNameForAutofilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0)
{ {
// definedName for autoFilter // definedName for autoFilter
$autoFilterRange = $pSheet->getAutoFilter()->getRange(); $autoFilterRange = $pSheet->getAutoFilter()->getRange();
@ -384,7 +376,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @param int $pSheetId * @param int $pSheetId
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeDefinedNameForPrintTitles(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) private function writeDefinedNameForPrintTitles(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0)
{ {
// definedName for PrintTitles // definedName for PrintTitles
if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) { if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
@ -427,7 +419,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
* @param int $pSheetId * @param int $pSheetId
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeDefinedNameForPrintArea(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) private function writeDefinedNameForPrintArea(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0)
{ {
// definedName for PrintArea // definedName for PrintArea
if ($pSheet->getPageSetup()->isPrintAreaSet()) { if ($pSheet->getPageSetup()->isPrintAreaSet()) {

View File

@ -65,67 +65,67 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
// sheetPr // sheetPr
$this->_writeSheetPr($objWriter, $pSheet); $this->writeSheetPr($objWriter, $pSheet);
// Dimension // Dimension
$this->_writeDimension($objWriter, $pSheet); $this->writeDimension($objWriter, $pSheet);
// sheetViews // sheetViews
$this->_writeSheetViews($objWriter, $pSheet); $this->writeSheetViews($objWriter, $pSheet);
// sheetFormatPr // sheetFormatPr
$this->_writeSheetFormatPr($objWriter, $pSheet); $this->writeSheetFormatPr($objWriter, $pSheet);
// cols // cols
$this->_writeCols($objWriter, $pSheet); $this->writeCols($objWriter, $pSheet);
// sheetData // sheetData
$this->_writeSheetData($objWriter, $pSheet, $pStringTable); $this->writeSheetData($objWriter, $pSheet, $pStringTable);
// sheetProtection // sheetProtection
$this->_writeSheetProtection($objWriter, $pSheet); $this->writeSheetProtection($objWriter, $pSheet);
// protectedRanges // protectedRanges
$this->_writeProtectedRanges($objWriter, $pSheet); $this->writeProtectedRanges($objWriter, $pSheet);
// autoFilter // autoFilter
$this->_writeAutoFilter($objWriter, $pSheet); $this->writeAutoFilter($objWriter, $pSheet);
// mergeCells // mergeCells
$this->_writeMergeCells($objWriter, $pSheet); $this->writeMergeCells($objWriter, $pSheet);
// conditionalFormatting // conditionalFormatting
$this->_writeConditionalFormatting($objWriter, $pSheet); $this->writeConditionalFormatting($objWriter, $pSheet);
// dataValidations // dataValidations
$this->_writeDataValidations($objWriter, $pSheet); $this->writeDataValidations($objWriter, $pSheet);
// hyperlinks // hyperlinks
$this->_writeHyperlinks($objWriter, $pSheet); $this->writeHyperlinks($objWriter, $pSheet);
// Print options // Print options
$this->_writePrintOptions($objWriter, $pSheet); $this->writePrintOptions($objWriter, $pSheet);
// Page margins // Page margins
$this->_writePageMargins($objWriter, $pSheet); $this->writePageMargins($objWriter, $pSheet);
// Page setup // Page setup
$this->_writePageSetup($objWriter, $pSheet); $this->writePageSetup($objWriter, $pSheet);
// Header / footer // Header / footer
$this->_writeHeaderFooter($objWriter, $pSheet); $this->writeHeaderFooter($objWriter, $pSheet);
// Breaks // Breaks
$this->_writeBreaks($objWriter, $pSheet); $this->writeBreaks($objWriter, $pSheet);
// Drawings and/or Charts // Drawings and/or Charts
$this->_writeDrawings($objWriter, $pSheet, $includeCharts); $this->writeDrawings($objWriter, $pSheet, $includeCharts);
// LegacyDrawing // LegacyDrawing
$this->_writeLegacyDrawing($objWriter, $pSheet); $this->writeLegacyDrawing($objWriter, $pSheet);
// LegacyDrawingHF // LegacyDrawingHF
$this->_writeLegacyDrawingHF($objWriter, $pSheet); $this->writeLegacyDrawingHF($objWriter, $pSheet);
$objWriter->endElement(); $objWriter->endElement();
@ -143,7 +143,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeSheetPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeSheetPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// sheetPr // sheetPr
$objWriter->startElement('sheetPr'); $objWriter->startElement('sheetPr');
@ -190,7 +190,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeDimension(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeDimension(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// dimension // dimension
$objWriter->startElement('dimension'); $objWriter->startElement('dimension');
@ -205,7 +205,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeSheetViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeSheetViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// sheetViews // sheetViews
$objWriter->startElement('sheetViews'); $objWriter->startElement('sheetViews');
@ -317,7 +317,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeSheetFormatPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeSheetFormatPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// sheetFormatPr // sheetFormatPr
$objWriter->startElement('sheetFormatPr'); $objWriter->startElement('sheetFormatPr');
@ -369,7 +369,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// cols // cols
if (count($pSheet->getColumnDimensions()) > 0) { if (count($pSheet->getColumnDimensions()) > 0) {
@ -434,7 +434,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeSheetProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeSheetProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// sheetProtection // sheetProtection
$objWriter->startElement('sheetProtection'); $objWriter->startElement('sheetProtection');
@ -469,7 +469,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeConditionalFormatting(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeConditionalFormatting(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// Conditional id // Conditional id
$id = 1; $id = 1;
@ -542,7 +542,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeDataValidations(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeDataValidations(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// Datavalidation collection // Datavalidation collection
$dataValidationCollection = $pSheet->getDataValidationCollection(); $dataValidationCollection = $pSheet->getDataValidationCollection();
@ -608,7 +608,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeHyperlinks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeHyperlinks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// Hyperlink collection // Hyperlink collection
$hyperlinkCollection = $pSheet->getHyperlinkCollection(); $hyperlinkCollection = $pSheet->getHyperlinkCollection();
@ -649,7 +649,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeProtectedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeProtectedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
if (count($pSheet->getProtectedCells()) > 0) { if (count($pSheet->getProtectedCells()) > 0) {
// protectedRanges // protectedRanges
@ -678,7 +678,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeMergeCells(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeMergeCells(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
if (count($pSheet->getMergeCells()) > 0) { if (count($pSheet->getMergeCells()) > 0) {
// mergeCells // mergeCells
@ -703,7 +703,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePrintOptions(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writePrintOptions(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// printOptions // printOptions
$objWriter->startElement('printOptions'); $objWriter->startElement('printOptions');
@ -729,7 +729,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePageMargins(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writePageMargins(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// pageMargins // pageMargins
$objWriter->startElement('pageMargins'); $objWriter->startElement('pageMargins');
@ -749,7 +749,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeAutoFilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeAutoFilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
$autoFilterRange = $pSheet->getAutoFilter()->getRange(); $autoFilterRange = $pSheet->getAutoFilter()->getRange();
if (!empty($autoFilterRange)) { if (!empty($autoFilterRange)) {
@ -842,7 +842,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePageSetup(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writePageSetup(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// pageSetup // pageSetup
$objWriter->startElement('pageSetup'); $objWriter->startElement('pageSetup');
@ -877,7 +877,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeHeaderFooter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeHeaderFooter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// headerFooter // headerFooter
$objWriter->startElement('headerFooter'); $objWriter->startElement('headerFooter');
@ -902,7 +902,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeBreaks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeBreaks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// Get row and column breaks // Get row and column breaks
$aRowBreaks = array(); $aRowBreaks = array();
@ -960,7 +960,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param string[] $pStringTable String table * @param string[] $pStringTable String table
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeSheetData(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pStringTable = null) private function writeSheetData(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pStringTable = null)
{ {
if (is_array($pStringTable)) { if (is_array($pStringTable)) {
// Flipped stringtable, for faster index searching // Flipped stringtable, for faster index searching
@ -1027,7 +1027,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
if (isset($cellsByRow[$currentRow])) { if (isset($cellsByRow[$currentRow])) {
foreach ($cellsByRow[$currentRow] as $cellAddress) { foreach ($cellsByRow[$currentRow] as $cellAddress) {
// Write cell // Write cell
$this->_writeCell($objWriter, $pSheet, $cellAddress, $pStringTable, $aFlippedStringTable); $this->writeCell($objWriter, $pSheet, $cellAddress, $pStringTable, $aFlippedStringTable);
} }
} }
@ -1052,7 +1052,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param string[] $pFlippedStringTable String table (flipped), for faster index searching * @param string[] $pFlippedStringTable String table (flipped), for faster index searching
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeCell(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pCellAddress = null, $pStringTable = null, $pFlippedStringTable = null) private function writeCell(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pCellAddress = null, $pStringTable = null, $pFlippedStringTable = null)
{ {
if (is_array($pStringTable) && is_array($pFlippedStringTable)) { if (is_array($pStringTable) && is_array($pFlippedStringTable)) {
// Cell // Cell
@ -1171,7 +1171,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param boolean $includeCharts Flag indicating if we should include drawing details for charts * @param boolean $includeCharts Flag indicating if we should include drawing details for charts
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeDrawings(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $includeCharts = false) private function writeDrawings(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $includeCharts = false)
{ {
$chartCount = ($includeCharts) ? $pSheet->getChartCollection()->count() : 0; $chartCount = ($includeCharts) ? $pSheet->getChartCollection()->count() : 0;
// If sheet contains drawings, add the relationships // If sheet contains drawings, add the relationships
@ -1190,7 +1190,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeLegacyDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeLegacyDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// If sheet contains comments, add the relationships // If sheet contains comments, add the relationships
if (count($pSheet->getComments()) > 0) { if (count($pSheet->getComments()) > 0) {
@ -1207,7 +1207,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet * @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeLegacyDrawingHF(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) private function writeLegacyDrawingHF(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{ {
// If sheet contains images, add the relationships // If sheet contains images, add the relationships
if (count($pSheet->getHeaderFooter()->getImages()) > 0) { if (count($pSheet->getHeaderFooter()->getImages()) > 0) {

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Writer_Excel2007_WriterPart
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @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##
*/ */
/**
* PHPExcel_Writer_Excel2007_WriterPart
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
abstract class PHPExcel_Writer_Excel2007_WriterPart abstract class PHPExcel_Writer_Excel2007_WriterPart
{ {
/** /**
@ -40,7 +32,7 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
* *
* @var PHPExcel_Writer_IWriter * @var PHPExcel_Writer_IWriter
*/ */
private $_parentWriter; private $parentWriter;
/** /**
* Set parent IWriter object * Set parent IWriter object
@ -50,7 +42,7 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
*/ */
public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null) public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null)
{ {
$this->_parentWriter = $pWriter; $this->parentWriter = $pWriter;
} }
/** /**
@ -61,8 +53,8 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
*/ */
public function getParentWriter() public function getParentWriter()
{ {
if (!is_null($this->_parentWriter)) { if (!is_null($this->parentWriter)) {
return $this->_parentWriter; return $this->parentWriter;
} else { } else {
throw new PHPExcel_Writer_Exception("No parent PHPExcel_Writer_IWriter assigned."); throw new PHPExcel_Writer_Exception("No parent PHPExcel_Writer_IWriter assigned.");
} }
@ -77,7 +69,7 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
public function __construct(PHPExcel_Writer_IWriter $pWriter = null) public function __construct(PHPExcel_Writer_IWriter $pWriter = null)
{ {
if (!is_null($pWriter)) { if (!is_null($pWriter)) {
$this->_parentWriter = $pWriter; $this->parentWriter = $pWriter;
} }
} }
} }

View File

@ -128,7 +128,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
// Initialise worksheet writers // Initialise worksheet writers
$countSheets = $this->phpExcel->getSheetCount(); $countSheets = $this->phpExcel->getSheetCount();
for ($i = 0; $i < $countSheets; ++$i) { for ($i = 0; $i < $countSheets; ++$i) {
$this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->strTotal, $this->strUnique, $this->strTable, $this->colors, $this->parser, $this->_preCalculateFormulas, $this->phpExcel->getSheet($i)); $this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->strTotal, $this->strUnique, $this->strTable, $this->colors, $this->parser, $this->preCalculateFormulas, $this->phpExcel->getSheet($i));
} }
// build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook. // build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook.

View File

@ -73,7 +73,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
* The byte order of this architecture. 0 => little endian, 1 => big endian * The byte order of this architecture. 0 => little endian, 1 => big endian
* @var integer * @var integer
*/ */
private static $_byte_order; private static $byteOrder;
/** /**
* The string containing the data of the BIFF stream * The string containing the data of the BIFF stream
@ -112,7 +112,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
*/ */
public static function getByteOrder() public static function getByteOrder()
{ {
if (!isset(self::$_byte_order)) { if (!isset(self::$byteOrder)) {
// Check if "pack" gives the required IEEE 64bit float // Check if "pack" gives the required IEEE 64bit float
$teststr = pack("d", 1.2345); $teststr = pack("d", 1.2345);
$number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F); $number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
@ -124,10 +124,10 @@ class PHPExcel_Writer_Excel5_BIFFwriter
// Give up. I'll fix this in a later version. // Give up. I'll fix this in a later version.
throw new PHPExcel_Writer_Exception("Required floating point format not supported on this platform."); throw new PHPExcel_Writer_Exception("Required floating point format not supported on this platform.");
} }
self::$_byte_order = $byte_order; self::$byteOrder = $byte_order;
} }
return self::$_byte_order; return self::$byteOrder;
} }
/** /**

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Writer_Excel5_Worksheet
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -59,15 +60,6 @@
// * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// */ // */
/**
* PHPExcel_Writer_Excel5_Worksheet
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel5
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
{ {
/** /**
@ -75,7 +67,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* *
* @var PHPExcel_Writer_Excel5_Parser * @var PHPExcel_Writer_Excel5_Parser
*/ */
private $_parser; private $parser;
/** /**
* Maximum number of characters for a string (LABEL record in BIFF5) * Maximum number of characters for a string (LABEL record in BIFF5)
@ -146,31 +138,31 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
/** /**
* Color cache * Color cache
*/ */
private $_colors; private $colors;
/** /**
* Index of first used row (at least 0) * Index of first used row (at least 0)
* @var int * @var int
*/ */
private $_firstRowIndex; private $firstRowIndex;
/** /**
* Index of last used row. (no used rows means -1) * Index of last used row. (no used rows means -1)
* @var int * @var int
*/ */
private $_lastRowIndex; private $lastRowIndex;
/** /**
* Index of first used column (at least 0) * Index of first used column (at least 0)
* @var int * @var int
*/ */
private $_firstColumnIndex; private $firstColumnIndex;
/** /**
* Index of last used column (no used columns means -1) * Index of last used column (no used columns means -1)
* @var int * @var int
*/ */
private $_lastColumnIndex; private $lastColumnIndex;
/** /**
* Sheet object * Sheet object
@ -183,14 +175,14 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* *
* @var int * @var int
*/ */
private $_countCellStyleXfs; private $countCellStyleXfs;
/** /**
* Escher object corresponding to MSODRAWING * Escher object corresponding to MSODRAWING
* *
* @var PHPExcel_Shared_Escher * @var PHPExcel_Shared_Escher
*/ */
private $_escher; private $escher;
/** /**
* Array of font hashes associated to FONT records index * Array of font hashes associated to FONT records index
@ -224,8 +216,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$this->_str_total = &$str_total; $this->_str_total = &$str_total;
$this->_str_unique = &$str_unique; $this->_str_unique = &$str_unique;
$this->_str_table = &$str_table; $this->_str_table = &$str_table;
$this->_colors = &$colors; $this->colors = &$colors;
$this->_parser = $parser; $this->parser = $parser;
$this->_phpSheet = $phpSheet; $this->_phpSheet = $phpSheet;
@ -253,18 +245,18 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$maxC = $this->_phpSheet->getHighestColumn(); $maxC = $this->_phpSheet->getHighestColumn();
// Determine lowest and highest column and row // Determine lowest and highest column and row
// $this->_firstRowIndex = ($minR > 65535) ? 65535 : $minR; // $this->firstRowIndex = ($minR > 65535) ? 65535 : $minR;
$this->_lastRowIndex = ($maxR > 65535) ? 65535 : $maxR ; $this->lastRowIndex = ($maxR > 65535) ? 65535 : $maxR ;
$this->_firstColumnIndex = PHPExcel_Cell::columnIndexFromString($minC); $this->firstColumnIndex = PHPExcel_Cell::columnIndexFromString($minC);
$this->_lastColumnIndex = PHPExcel_Cell::columnIndexFromString($maxC); $this->lastColumnIndex = PHPExcel_Cell::columnIndexFromString($maxC);
// if ($this->_firstColumnIndex > 255) $this->_firstColumnIndex = 255; // if ($this->firstColumnIndex > 255) $this->firstColumnIndex = 255;
if ($this->_lastColumnIndex > 255) { if ($this->lastColumnIndex > 255) {
$this->_lastColumnIndex = 255; $this->lastColumnIndex = 255;
} }
$this->_countCellStyleXfs = count($phpSheet->getParent()->getCellStyleXfCollection()); $this->countCellStyleXfs = count($phpSheet->getParent()->getCellStyleXfCollection());
} }
/** /**
@ -301,7 +293,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
} }
$columnDimensions = $_phpSheet->getColumnDimensions(); $columnDimensions = $_phpSheet->getColumnDimensions();
$maxCol = $this->_lastColumnIndex -1; $maxCol = $this->lastColumnIndex -1;
for ($i = 0; $i <= $maxCol; ++$i) { for ($i = 0; $i <= $maxCol; ++$i) {
$hidden = 0; $hidden = 0;
$level = 0; $level = 0;
@ -334,7 +326,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$this->_writeGuts(); $this->_writeGuts();
// Write DEFAULTROWHEIGHT // Write DEFAULTROWHEIGHT
$this->_writeDefaultRowHeight(); $this->writeDefaultRowHeight();
// Write WSBOOL // Write WSBOOL
$this->_writeWsbool(); $this->_writeWsbool();
@ -398,12 +390,12 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
} }
// Write sheet dimensions // Write sheet dimensions
$this->_writeDimensions(); $this->writeDimensions();
// Row dimensions // Row dimensions
foreach ($_phpSheet->getRowDimensions() as $rowDimension) { foreach ($_phpSheet->getRowDimensions() as $rowDimension) {
$xfIndex = $rowDimension->getXfIndex() + 15; // there are 15 cellXfs $xfIndex = $rowDimension->getXfIndex() + 15; // there are 15 cellXfs
$this->_writeRow($rowDimension->getRowIndex() - 1, $rowDimension->getRowHeight(), $xfIndex, ($rowDimension->getVisible() ? '0' : '1'), $rowDimension->getOutlineLevel()); $this->writeRow($rowDimension->getRowIndex() - 1, $rowDimension->getRowHeight(), $xfIndex, ($rowDimension->getVisible() ? '0' : '1'), $rowDimension->getOutlineLevel());
} }
// Write Cells // Write Cells
@ -423,7 +415,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$cVal = $cell->getValue(); $cVal = $cell->getValue();
if ($cVal instanceof PHPExcel_RichText) { if ($cVal instanceof PHPExcel_RichText) {
// $this->_writeString($row, $column, $cVal->getPlainText(), $xfIndex); // $this->writeString($row, $column, $cVal->getPlainText(), $xfIndex);
$arrcRun = array(); $arrcRun = array();
$str_len = PHPExcel_Shared_String::CountCharacters($cVal->getPlainText(), 'UTF-8'); $str_len = PHPExcel_Shared_String::CountCharacters($cVal->getPlainText(), 'UTF-8');
$str_pos = 0; $str_pos = 0;
@ -439,7 +431,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// Position FROM // Position FROM
$str_pos += PHPExcel_Shared_String::CountCharacters($element->getText(), 'UTF-8'); $str_pos += PHPExcel_Shared_String::CountCharacters($element->getText(), 'UTF-8');
} }
$this->_writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun); $this->writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun);
} else { } else {
switch ($cell->getDatatype()) { switch ($cell->getDatatype()) {
case PHPExcel_Cell_DataType::TYPE_STRING: case PHPExcel_Cell_DataType::TYPE_STRING:
@ -447,26 +439,26 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
if ($cVal === '' || $cVal === null) { if ($cVal === '' || $cVal === null) {
$this->_writeBlank($row, $column, $xfIndex); $this->_writeBlank($row, $column, $xfIndex);
} else { } else {
$this->_writeString($row, $column, $cVal, $xfIndex); $this->writeString($row, $column, $cVal, $xfIndex);
} }
break; break;
case PHPExcel_Cell_DataType::TYPE_NUMERIC: case PHPExcel_Cell_DataType::TYPE_NUMERIC:
$this->_writeNumber($row, $column, $cVal, $xfIndex); $this->writeNumber($row, $column, $cVal, $xfIndex);
break; break;
case PHPExcel_Cell_DataType::TYPE_FORMULA: case PHPExcel_Cell_DataType::TYPE_FORMULA:
$calculatedValue = $this->_preCalculateFormulas ? $calculatedValue = $this->_preCalculateFormulas ?
$cell->getCalculatedValue() : null; $cell->getCalculatedValue() : null;
$this->_writeFormula($row, $column, $cVal, $xfIndex, $calculatedValue); $this->writeFormula($row, $column, $cVal, $xfIndex, $calculatedValue);
break; break;
case PHPExcel_Cell_DataType::TYPE_BOOL: case PHPExcel_Cell_DataType::TYPE_BOOL:
$this->_writeBoolErr($row, $column, $cVal, 0, $xfIndex); $this->writeBoolErr($row, $column, $cVal, 0, $xfIndex);
break; break;
case PHPExcel_Cell_DataType::TYPE_ERROR: case PHPExcel_Cell_DataType::TYPE_ERROR:
$this->_writeBoolErr($row, $column, self::_mapErrorCode($cVal), 1, $xfIndex); $this->writeBoolErr($row, $column, self::_mapErrorCode($cVal), 1, $xfIndex);
break; break;
} }
@ -477,7 +469,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$this->_writeMsoDrawing(); $this->_writeMsoDrawing();
// Write WINDOW2 record // Write WINDOW2 record
$this->_writeWindow2(); $this->writeWindow2();
// Write PLV record // Write PLV record
$this->_writePageLayoutView(); $this->_writePageLayoutView();
@ -513,7 +505,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$url = 'external:' . $url; $url = 'external:' . $url;
} }
$this->_writeUrl($row - 1, PHPExcel_Cell::columnIndexFromString($column) - 1, $url); $this->writeUrl($row - 1, PHPExcel_Cell::columnIndexFromString($column) - 1, $url);
} }
$this->_writeDataValidity(); $this->_writeDataValidity();
@ -528,7 +520,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$arrConditional = array(); $arrConditional = array();
// @todo CFRule & CFHeader // @todo CFRule & CFHeader
// Write CFHEADER record // Write CFHEADER record
$this->_writeCFHeader(); $this->writeCFHeader();
// Write ConditionalFormattingTable records // Write ConditionalFormattingTable records
foreach ($arrConditionalStyles as $cellCoordinate => $conditionalStyles) { foreach ($arrConditionalStyles as $cellCoordinate => $conditionalStyles) {
foreach ($conditionalStyles as $conditional) { foreach ($conditionalStyles as $conditional) {
@ -537,7 +529,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
if (!in_array($conditional->getHashCode(), $arrConditional)) { if (!in_array($conditional->getHashCode(), $arrConditional)) {
$arrConditional[] = $conditional->getHashCode(); $arrConditional[] = $conditional->getHashCode();
// Write CFRULE record // Write CFRULE record
$this->_writeCFRule($conditional); $this->writeCFRule($conditional);
} }
} }
} }
@ -555,7 +547,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $range E.g. 'A1' or 'A1:B6' * @param string $range E.g. 'A1' or 'A1:B6'
* @return string Binary data * @return string Binary data
*/ */
private function _writeBIFF8CellRangeAddressFixed($range = 'A1') private function writeBIFF8CellRangeAddressFixed($range = 'A1')
{ {
$explodes = explode(':', $range); $explodes = explode(':', $range);
@ -642,7 +634,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param mixed $xfIndex The optional XF format * @param mixed $xfIndex The optional XF format
* @return integer * @return integer
*/ */
private function _writeNumber($row, $col, $num, $xfIndex) private function writeNumber($row, $col, $num, $xfIndex)
{ {
$record = 0x0203; // Record identifier $record = 0x0203; // Record identifier
$length = 0x000E; // Number of bytes to follow $length = 0x000E; // Number of bytes to follow
@ -666,21 +658,21 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $str The string * @param string $str The string
* @param int $xfIndex Index to XF record * @param int $xfIndex Index to XF record
*/ */
private function _writeString($row, $col, $str, $xfIndex) private function writeString($row, $col, $str, $xfIndex)
{ {
$this->_writeLabelSst($row, $col, $str, $xfIndex); $this->writeLabelSst($row, $col, $str, $xfIndex);
} }
/** /**
* Write a LABELSST record or a LABEL record. Which one depends on BIFF version * Write a LABELSST record or a LABEL record. Which one depends on BIFF version
* It differs from _writeString by the writing of rich text strings. * It differs from writeString by the writing of rich text strings.
* @param int $row Row index (0-based) * @param int $row Row index (0-based)
* @param int $col Column index (0-based) * @param int $col Column index (0-based)
* @param string $str The string * @param string $str The string
* @param mixed $xfIndex The XF format index for the cell * @param mixed $xfIndex The XF format index for the cell
* @param array $arrcRun Index to Font record and characters beginning * @param array $arrcRun Index to Font record and characters beginning
*/ */
private function _writeRichTextString($row, $col, $str, $xfIndex, $arrcRun) private function writeRichTextString($row, $col, $str, $xfIndex, $arrcRun)
{ {
$record = 0x00FD; // Record identifier $record = 0x00FD; // Record identifier
$length = 0x000A; // Bytes to follow $length = 0x000A; // Bytes to follow
@ -712,7 +704,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param mixed $xfIndex The XF format index for the cell * @param mixed $xfIndex The XF format index for the cell
* @return integer * @return integer
*/ */
private function _writeLabel($row, $col, $str, $xfIndex) private function writeLabel($row, $col, $str, $xfIndex)
{ {
$strlen = strlen($str); $strlen = strlen($str);
$record = 0x0204; // Record identifier $record = 0x0204; // Record identifier
@ -748,7 +740,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param mixed $xfIndex The XF format index for the cell * @param mixed $xfIndex The XF format index for the cell
* @return integer * @return integer
*/ */
private function _writeLabelSst($row, $col, $str, $xfIndex) private function writeLabelSst($row, $col, $str, $xfIndex)
{ {
$record = 0x00FD; // Record identifier $record = 0x00FD; // Record identifier
$length = 0x000A; // Bytes to follow $length = 0x000A; // Bytes to follow
@ -774,7 +766,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param integer $col Zero indexed column * @param integer $col Zero indexed column
* @param string $note The note to write * @param string $note The note to write
*/ */
private function _writeNote($row, $col, $note) private function writeNote($row, $col, $note)
{ {
$note_length = strlen($note); $note_length = strlen($note);
$record = 0x001C; // Record identifier $record = 0x001C; // Record identifier
@ -832,7 +824,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param boolean $isError Error or Boolean? * @param boolean $isError Error or Boolean?
* @param int $xfIndex * @param int $xfIndex
*/ */
private function _writeBoolErr($row, $col, $value, $isError, $xfIndex) private function writeBoolErr($row, $col, $value, $isError, $xfIndex)
{ {
$record = 0x0205; $record = 0x0205;
$length = 8; $length = 8;
@ -859,7 +851,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param mixed $calculatedValue Calculated value * @param mixed $calculatedValue Calculated value
* @return integer * @return integer
*/ */
private function _writeFormula($row, $col, $formula, $xfIndex, $calculatedValue) private function writeFormula($row, $col, $formula, $xfIndex, $calculatedValue)
{ {
$record = 0x0006; // Record identifier $record = 0x0006; // Record identifier
@ -904,14 +896,14 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$formula = substr($formula, 1); $formula = substr($formula, 1);
} else { } else {
// Error handling // Error handling
$this->_writeString($row, $col, 'Unrecognised character for formula'); $this->writeString($row, $col, 'Unrecognised character for formula');
return -1; return -1;
} }
// Parse the formula using the parser in Parser.php // Parse the formula using the parser in Parser.php
try { try {
$error = $this->_parser->parse($formula); $error = $this->parser->parse($formula);
$formula = $this->_parser->toReversePolish(); $formula = $this->parser->toReversePolish();
$formlen = strlen($formula); // Length of the binary string $formlen = strlen($formula); // Length of the binary string
$length = 0x16 + $formlen; // Length of the record data $length = 0x16 + $formlen; // Length of the record data
@ -925,7 +917,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// Append also a STRING record if necessary // Append also a STRING record if necessary
if ($stringValue !== null) { if ($stringValue !== null) {
$this->_writeStringRecord($stringValue); $this->writeStringRecord($stringValue);
} }
return 0; return 0;
@ -941,7 +933,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* *
* @param string $stringValue * @param string $stringValue
*/ */
private function _writeStringRecord($stringValue) private function writeStringRecord($stringValue)
{ {
$record = 0x0207; // Record identifier $record = 0x0207; // Record identifier
$data = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($stringValue); $data = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($stringValue);
@ -957,7 +949,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* This is comprised of two elements: the visible label and * This is comprised of two elements: the visible label and
* the invisible link. The visible label is the same as the link unless an * the invisible link. The visible label is the same as the link unless an
* alternative string is specified. The label is written using the * alternative string is specified. The label is written using the
* _writeString() method. Therefore the 255 characters string limit applies. * writeString() method. Therefore the 255 characters string limit applies.
* $string and $format are optional. * $string and $format are optional.
* *
* The hyperlink can be to a http, ftp, mail, internal sheet (not yet), or external * The hyperlink can be to a http, ftp, mail, internal sheet (not yet), or external
@ -972,20 +964,20 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $url URL string * @param string $url URL string
* @return integer * @return integer
*/ */
private function _writeUrl($row, $col, $url) private function writeUrl($row, $col, $url)
{ {
// Add start row and col to arg list // Add start row and col to arg list
return($this->_writeUrlRange($row, $col, $row, $col, $url)); return($this->writeUrlRange($row, $col, $row, $col, $url));
} }
/** /**
* This is the more general form of _writeUrl(). It allows a hyperlink to be * This is the more general form of writeUrl(). It allows a hyperlink to be
* written to a range of cells. This function also decides the type of hyperlink * written to a range of cells. This function also decides the type of hyperlink
* to be written. These are either, Web (http, ftp, mailto), Internal * to be written. These are either, Web (http, ftp, mailto), Internal
* (Sheet1!A1) or external ('c:\temp\foo.xls#Sheet1!A1'). * (Sheet1!A1) or external ('c:\temp\foo.xls#Sheet1!A1').
* *
* @access private * @access private
* @see _writeUrl() * @see writeUrl()
* @param integer $row1 Start row * @param integer $row1 Start row
* @param integer $col1 Start column * @param integer $col1 Start column
* @param integer $row2 End row * @param integer $row2 End row
@ -993,16 +985,16 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $url URL string * @param string $url URL string
* @return integer * @return integer
*/ */
public function _writeUrlRange($row1, $col1, $row2, $col2, $url) public function writeUrlRange($row1, $col1, $row2, $col2, $url)
{ {
// Check for internal/external sheet links or default to web link // Check for internal/external sheet links or default to web link
if (preg_match('[^internal:]', $url)) { if (preg_match('[^internal:]', $url)) {
return($this->_writeUrlInternal($row1, $col1, $row2, $col2, $url)); return($this->writeUrlInternal($row1, $col1, $row2, $col2, $url));
} }
if (preg_match('[^external:]', $url)) { if (preg_match('[^external:]', $url)) {
return($this->_writeUrlExternal($row1, $col1, $row2, $col2, $url)); return($this->writeUrlExternal($row1, $col1, $row2, $col2, $url));
} }
return($this->_writeUrlWeb($row1, $col1, $row2, $col2, $url)); return($this->writeUrlWeb($row1, $col1, $row2, $col2, $url));
} }
/** /**
@ -1011,7 +1003,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* sheet. However it is differentiated by the $unknown2 data stream. * sheet. However it is differentiated by the $unknown2 data stream.
* *
* @access private * @access private
* @see _writeUrl() * @see writeUrl()
* @param integer $row1 Start row * @param integer $row1 Start row
* @param integer $col1 Start column * @param integer $col1 Start column
* @param integer $row2 End row * @param integer $row2 End row
@ -1019,7 +1011,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $url URL string * @param string $url URL string
* @return integer * @return integer
*/ */
public function _writeUrlWeb($row1, $col1, $row2, $col2, $url) public function writeUrlWeb($row1, $col1, $row2, $col2, $url)
{ {
$record = 0x01B8; // Record identifier $record = 0x01B8; // Record identifier
$length = 0x00000; // Bytes to follow $length = 0x00000; // Bytes to follow
@ -1056,7 +1048,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* Used to write internal reference hyperlinks such as "Sheet1!A1". * Used to write internal reference hyperlinks such as "Sheet1!A1".
* *
* @access private * @access private
* @see _writeUrl() * @see writeUrl()
* @param integer $row1 Start row * @param integer $row1 Start row
* @param integer $col1 Start column * @param integer $col1 Start column
* @param integer $row2 End row * @param integer $row2 End row
@ -1064,7 +1056,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $url URL string * @param string $url URL string
* @return integer * @return integer
*/ */
public function _writeUrlInternal($row1, $col1, $row2, $col2, $url) public function writeUrlInternal($row1, $col1, $row2, $col2, $url)
{ {
$record = 0x01B8; // Record identifier $record = 0x01B8; // Record identifier
$length = 0x00000; // Bytes to follow $length = 0x00000; // Bytes to follow
@ -1109,7 +1101,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* these cases for the sake of simpler code. * these cases for the sake of simpler code.
* *
* @access private * @access private
* @see _writeUrl() * @see writeUrl()
* @param integer $row1 Start row * @param integer $row1 Start row
* @param integer $col1 Start column * @param integer $col1 Start column
* @param integer $row2 End row * @param integer $row2 End row
@ -1117,12 +1109,12 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $url URL string * @param string $url URL string
* @return integer * @return integer
*/ */
public function _writeUrlExternal($row1, $col1, $row2, $col2, $url) public function writeUrlExternal($row1, $col1, $row2, $col2, $url)
{ {
// Network drives are different. We will handle them separately // Network drives are different. We will handle them separately
// MS/Novell network drives and shares start with \\ // MS/Novell network drives and shares start with \\
if (preg_match('[^external:\\\\]', $url)) { if (preg_match('[^external:\\\\]', $url)) {
return; //($this->_writeUrlExternal_net($row1, $col1, $row2, $col2, $url, $str, $format)); return; //($this->writeUrlExternal_net($row1, $col1, $row2, $col2, $url, $str, $format));
} }
$record = 0x01B8; // Record identifier $record = 0x01B8; // Record identifier
@ -1212,7 +1204,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param bool $hidden The optional hidden attribute * @param bool $hidden The optional hidden attribute
* @param integer $level The optional outline level for row, in range [0,7] * @param integer $level The optional outline level for row, in range [0,7]
*/ */
private function _writeRow($row, $height, $xfIndex, $hidden = false, $level = 0) private function writeRow($row, $height, $xfIndex, $hidden = false, $level = 0)
{ {
$record = 0x0208; // Record identifier $record = 0x0208; // Record identifier
$length = 0x0010; // Number of bytes to follow $length = 0x0010; // Number of bytes to follow
@ -1228,7 +1220,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$height = null; $height = null;
} }
// Use _writeRow($row, null, $XF) to set XF format without setting height // Use writeRow($row, null, $XF) to set XF format without setting height
if ($height != null) { if ($height != null) {
$miyRw = $height * 20; // row height $miyRw = $height * 20; // row height
} else { } else {
@ -1261,12 +1253,12 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
/** /**
* Writes Excel DIMENSIONS to define the area in which there is data. * Writes Excel DIMENSIONS to define the area in which there is data.
*/ */
private function _writeDimensions() private function writeDimensions()
{ {
$record = 0x0200; // Record identifier $record = 0x0200; // Record identifier
$length = 0x000E; $length = 0x000E;
$data = pack('VVvvv', $this->_firstRowIndex, $this->_lastRowIndex + 1, $this->_firstColumnIndex, $this->_lastColumnIndex + 1, 0x0000); // reserved $data = pack('VVvvv', $this->firstRowIndex, $this->lastRowIndex + 1, $this->firstColumnIndex, $this->lastColumnIndex + 1, 0x0000); // reserved
$header = pack("vv", $record, $length); $header = pack("vv", $record, $length);
$this->_append($header.$data); $this->_append($header.$data);
@ -1275,7 +1267,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
/** /**
* Write BIFF record Window2. * Write BIFF record Window2.
*/ */
private function _writeWindow2() private function writeWindow2()
{ {
$record = 0x023E; // Record identifier $record = 0x023E; // Record identifier
$length = 0x0012; $length = 0x0012;
@ -1329,7 +1321,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
/** /**
* Write BIFF record DEFAULTROWHEIGHT. * Write BIFF record DEFAULTROWHEIGHT.
*/ */
private function _writeDefaultRowHeight() private function writeDefaultRowHeight()
{ {
$defaultRowHeight = $this->_phpSheet->getDefaultRowDimension()->getRowHeight(); $defaultRowHeight = $this->_phpSheet->getDefaultRowDimension()->getRowHeight();
@ -1552,7 +1544,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
0x00000000, // unused 0x00000000, // unused
0x00000000, // unused 0x00000000, // unused
0x00000014, // size of record data 0x00000014, // size of record data
$this->_colors[$this->_phpSheet->getTabColor()->getRGB()], // color index $this->colors[$this->_phpSheet->getTabColor()->getRGB()], // color index
0x0000 // unused 0x0000 // unused
); );
@ -1635,7 +1627,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
); );
foreach ($cellRanges as $cellRange) { foreach ($cellRanges as $cellRange) {
$recordData .= $this->_writeBIFF8CellRangeAddressFixed($cellRange); $recordData .= $this->writeBIFF8CellRangeAddressFixed($cellRange);
} }
// the rgbFeat structure // the rgbFeat structure
@ -2096,7 +2088,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$col_level = 0; $col_level = 0;
// Calculate the maximum column outline level. The equivalent calculation // Calculate the maximum column outline level. The equivalent calculation
// for the row outline level is carried out in _writeRow(). // for the row outline level is carried out in writeRow().
$colcount = count($this->_colinfo); $colcount = count($this->_colinfo);
for ($i = 0; $i < $colcount; ++$i) { for ($i = 0; $i < $colcount; ++$i) {
$col_level = max($this->_colinfo[$i][5], $col_level); $col_level = max($this->_colinfo[$i][5], $col_level);
@ -2687,7 +2679,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
*/ */
public function getEscher() public function getEscher()
{ {
return $this->_escher; return $this->escher;
} }
/** /**
@ -2697,7 +2689,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
*/ */
public function setEscher(PHPExcel_Shared_Escher $pValue = null) public function setEscher(PHPExcel_Shared_Escher $pValue = null)
{ {
$this->_escher = $pValue; $this->escher = $pValue;
} }
/** /**
@ -2706,8 +2698,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
private function _writeMsoDrawing() private function _writeMsoDrawing()
{ {
// write the Escher stream if necessary // write the Escher stream if necessary
if (isset($this->_escher)) { if (isset($this->escher)) {
$writer = new PHPExcel_Writer_Excel5_Escher($this->_escher); $writer = new PHPExcel_Writer_Excel5_Escher($this->escher);
$data = $writer->close(); $data = $writer->close();
$spOffsets = $writer->getSpOffsets(); $spOffsets = $writer->getSpOffsets();
$spTypes = $writer->getSpTypes(); $spTypes = $writer->getSpTypes();
@ -2938,8 +2930,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
if ($type == 0x03) { // list type if ($type == 0x03) { // list type
$formula1 = str_replace(',', chr(0), $formula1); $formula1 = str_replace(',', chr(0), $formula1);
} }
$this->_parser->parse($formula1); $this->parser->parse($formula1);
$formula1 = $this->_parser->toReversePolish(); $formula1 = $this->parser->toReversePolish();
$sz1 = strlen($formula1); $sz1 = strlen($formula1);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$sz1 = 0; $sz1 = 0;
@ -2954,8 +2946,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
if ($formula2 === '') { if ($formula2 === '') {
throw new PHPExcel_Writer_Exception('No formula2'); throw new PHPExcel_Writer_Exception('No formula2');
} }
$this->_parser->parse($formula2); $this->parser->parse($formula2);
$formula2 = $this->_parser->toReversePolish(); $formula2 = $this->parser->toReversePolish();
$sz2 = strlen($formula2); $sz2 = strlen($formula2);
} catch (PHPExcel_Exception $e) { } catch (PHPExcel_Exception $e) {
$sz2 = 0; $sz2 = 0;
@ -2966,7 +2958,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// cell range address list // cell range address list
$data .= pack('v', 0x0001); $data .= pack('v', 0x0001);
$data .= $this->_writeBIFF8CellRangeAddressFixed($cellCoordinate); $data .= $this->writeBIFF8CellRangeAddressFixed($cellCoordinate);
$length = strlen($data); $length = strlen($data);
$header = pack("vv", $record, $length); $header = pack("vv", $record, $length);
@ -3039,7 +3031,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* Write CFRule Record * Write CFRule Record
* @param PHPExcel_Style_Conditional $conditional * @param PHPExcel_Style_Conditional $conditional
*/ */
private function _writeCFRule(PHPExcel_Style_Conditional $conditional) private function writeCFRule(PHPExcel_Style_Conditional $conditional)
{ {
$record = 0x01B1; // Record identifier $record = 0x01B1; // Record identifier
@ -3699,14 +3691,14 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$blockLineStyle |= 0x0D << 12; $blockLineStyle |= 0x0D << 12;
break; break;
} }
//@todo _writeCFRule() => $blockLineStyle => Index Color for left line //@todo writeCFRule() => $blockLineStyle => Index Color for left line
//@todo _writeCFRule() => $blockLineStyle => Index Color for right line //@todo writeCFRule() => $blockLineStyle => Index Color for right line
//@todo _writeCFRule() => $blockLineStyle => Top-left to bottom-right on/off //@todo writeCFRule() => $blockLineStyle => Top-left to bottom-right on/off
//@todo _writeCFRule() => $blockLineStyle => Bottom-left to top-right on/off //@todo writeCFRule() => $blockLineStyle => Bottom-left to top-right on/off
$blockColor = 0; $blockColor = 0;
//@todo _writeCFRule() => $blockColor => Index Color for top line //@todo writeCFRule() => $blockColor => Index Color for top line
//@todo _writeCFRule() => $blockColor => Index Color for bottom line //@todo writeCFRule() => $blockColor => Index Color for bottom line
//@todo _writeCFRule() => $blockColor => Index Color for diagonal line //@todo writeCFRule() => $blockColor => Index Color for diagonal line
switch ($conditional->getStyle()->getBorders()->getDiagonal()->getBorderStyle()) { switch ($conditional->getStyle()->getBorders()->getDiagonal()->getBorderStyle()) {
case PHPExcel_Style_Border::BORDER_NONE: case PHPExcel_Style_Border::BORDER_NONE:
$blockColor |= 0x00 << 21; $blockColor |= 0x00 << 21;
@ -4214,7 +4206,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
/** /**
* Write CFHeader record * Write CFHeader record
*/ */
private function _writeCFHeader() private function writeCFHeader()
{ {
$record = 0x01B0; // Record identifier $record = 0x01B0; // Record identifier
$length = 0x0016; // Bytes to follow $length = 0x0016; // Bytes to follow

View File

@ -1221,7 +1221,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
} }
} }
} else { } else {
if ($this->_preCalculateFormulas) { if ($this->preCalculateFormulas) {
$cellData = PHPExcel_Style_NumberFormat::toFormattedString( $cellData = PHPExcel_Style_NumberFormat::toFormattedString(
$cell->getCalculatedValue(), $cell->getCalculatedValue(),
$pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode(), $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode(),