mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-22 13:26:07 +03:00
PSR-2 : Fixes
This commit is contained in:
parent
06c1ea78de
commit
2881bca443
@ -304,7 +304,8 @@ class PHPExcel_Chart
|
||||
* @param PHPExcel_Chart_Title $label
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setYAxisLabel(PHPExcel_Chart_Title $label) {
|
||||
public function setYAxisLabel(PHPExcel_Chart_Title $label)
|
||||
{
|
||||
$this->_yAxisLabel = $label;
|
||||
|
||||
return $this;
|
||||
|
@ -442,8 +442,7 @@ class PHPExcel_Shared_String
|
||||
$data = pack('CC', $ln, $opt);
|
||||
// characters
|
||||
$data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$data = pack('vC', $ln, 0x09);
|
||||
$data .= pack('v', count($arrcRuns));
|
||||
// characters
|
||||
|
@ -98,7 +98,7 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
$sheet = $this->_phpExcel->getSheet($this->_sheetIndex);
|
||||
|
||||
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
|
||||
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE);
|
||||
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false);
|
||||
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
|
||||
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
|
||||
|
||||
@ -143,7 +143,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDelimiter() {
|
||||
public function getDelimiter()
|
||||
{
|
||||
return $this->_delimiter;
|
||||
}
|
||||
|
||||
@ -153,7 +154,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param string $pValue Delimiter, defaults to ,
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setDelimiter($pValue = ',') {
|
||||
public function setDelimiter($pValue = ',')
|
||||
{
|
||||
$this->_delimiter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -163,7 +165,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEnclosure() {
|
||||
public function getEnclosure()
|
||||
{
|
||||
return $this->_enclosure;
|
||||
}
|
||||
|
||||
@ -173,7 +176,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param string $pValue Enclosure, defaults to "
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setEnclosure($pValue = '"') {
|
||||
public function setEnclosure($pValue = '"')
|
||||
{
|
||||
if ($pValue == '') {
|
||||
$pValue = null;
|
||||
}
|
||||
@ -186,7 +190,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLineEnding() {
|
||||
public function getLineEnding()
|
||||
{
|
||||
return $this->_lineEnding;
|
||||
}
|
||||
|
||||
@ -196,7 +201,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setLineEnding($pValue = PHP_EOL) {
|
||||
public function setLineEnding($pValue = PHP_EOL)
|
||||
{
|
||||
$this->_lineEnding = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -206,7 +212,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getUseBOM() {
|
||||
public function getUseBOM()
|
||||
{
|
||||
return $this->_useBOM;
|
||||
}
|
||||
|
||||
@ -216,7 +223,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param boolean $pValue Use UTF-8 byte-order mark? Defaults to false
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setUseBOM($pValue = false) {
|
||||
public function setUseBOM($pValue = false)
|
||||
{
|
||||
$this->_useBOM = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -226,7 +234,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getExcelCompatibility() {
|
||||
public function getExcelCompatibility()
|
||||
{
|
||||
return $this->_excelCompatibility;
|
||||
}
|
||||
|
||||
@ -237,7 +246,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* Note that this overrides other settings such as useBOM, enclosure and delimiter
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setExcelCompatibility($pValue = false) {
|
||||
public function setExcelCompatibility($pValue = false)
|
||||
{
|
||||
$this->_excelCompatibility = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -247,7 +257,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSheetIndex() {
|
||||
public function getSheetIndex()
|
||||
{
|
||||
return $this->_sheetIndex;
|
||||
}
|
||||
|
||||
@ -257,7 +268,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param int $pValue Sheet index
|
||||
* @return PHPExcel_Writer_CSV
|
||||
*/
|
||||
public function setSheetIndex($pValue = 0) {
|
||||
public function setSheetIndex($pValue = 0)
|
||||
{
|
||||
$this->_sheetIndex = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -269,7 +281,8 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
* @param array $pValues Array containing values in a row
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
private function _writeLine($pFileHandle = null, $pValues = null) {
|
||||
private function _writeLine($pFileHandle = null, $pValues = null)
|
||||
{
|
||||
if (is_array($pValues)) {
|
||||
// No leading delimiter
|
||||
$writeDelimiter = false;
|
||||
@ -301,5 +314,4 @@ class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_W
|
||||
throw new PHPExcel_Writer_Exception("Invalid data row passed to CSV writer.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -163,7 +163,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
* @param string $pPartName Writer part name
|
||||
* @return PHPExcel_Writer_Excel2007_WriterPart
|
||||
*/
|
||||
public function getWriterPart($pPartName = '') {
|
||||
public function getWriterPart($pPartName = '')
|
||||
{
|
||||
if ($pPartName != '' && isset($this->_writerParts[strtolower($pPartName)])) {
|
||||
return $this->_writerParts[strtolower($pPartName)];
|
||||
} else {
|
||||
@ -179,7 +180,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*/
|
||||
public function save($pFilename = null)
|
||||
{
|
||||
if ($this->_spreadSheet !== NULL) {
|
||||
if ($this->_spreadSheet !== null) {
|
||||
// garbage collect
|
||||
$this->_spreadSheet->garbageCollect();
|
||||
|
||||
@ -193,7 +194,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
}
|
||||
|
||||
$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();
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
|
||||
@ -245,8 +246,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
if ($this->_spreadSheet->hasMacrosCertificate()) {//signed macros ?
|
||||
// Yes : add the certificate file and the related rels file
|
||||
$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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -261,8 +261,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
$objZip->addFromString($tmpRootPath.$aPath, $aContent);
|
||||
}
|
||||
//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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,7 +273,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
$objZip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->writeDocPropsApp($this->_spreadSheet));
|
||||
$objZip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->writeDocPropsCore($this->_spreadSheet));
|
||||
$customPropertiesPart = $this->getWriterPart('DocProps')->writeDocPropsCustom($this->_spreadSheet);
|
||||
if ($customPropertiesPart !== NULL) {
|
||||
if ($customPropertiesPart !== null) {
|
||||
$objZip->addFromString('docProps/custom.xml', $customPropertiesPart);
|
||||
}
|
||||
|
||||
@ -308,7 +307,6 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
$chartRef1 = $chartRef2 = 0;
|
||||
// Add worksheet relationships (drawings, ...)
|
||||
for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) {
|
||||
|
||||
// Add relationships
|
||||
$objZip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->_spreadSheet->getSheet($i), ($i + 1), $this->_includeCharts));
|
||||
|
||||
@ -409,7 +407,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
* @return PHPExcel
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function getPHPExcel() {
|
||||
public function getPHPExcel()
|
||||
{
|
||||
if ($this->_spreadSheet !== null) {
|
||||
return $this->_spreadSheet;
|
||||
} else {
|
||||
@ -424,7 +423,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
* @return PHPExcel_Writer_Excel2007
|
||||
*/
|
||||
public function setPHPExcel(PHPExcel $pPHPExcel = null) {
|
||||
public function setPHPExcel(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
$this->_spreadSheet = $pPHPExcel;
|
||||
return $this;
|
||||
}
|
||||
@ -434,7 +434,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getStringTable() {
|
||||
public function getStringTable()
|
||||
{
|
||||
return $this->_stringTable;
|
||||
}
|
||||
|
||||
@ -443,7 +444,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getStyleHashTable() {
|
||||
public function getStyleHashTable()
|
||||
{
|
||||
return $this->_styleHashTable;
|
||||
}
|
||||
|
||||
@ -452,7 +454,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getStylesConditionalHashTable() {
|
||||
public function getStylesConditionalHashTable()
|
||||
{
|
||||
return $this->_stylesConditionalHashTable;
|
||||
}
|
||||
|
||||
@ -461,7 +464,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getFillHashTable() {
|
||||
public function getFillHashTable()
|
||||
{
|
||||
return $this->_fillHashTable;
|
||||
}
|
||||
|
||||
@ -470,7 +474,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getFontHashTable() {
|
||||
public function getFontHashTable()
|
||||
{
|
||||
return $this->_fontHashTable;
|
||||
}
|
||||
|
||||
@ -479,7 +484,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getBordersHashTable() {
|
||||
public function getBordersHashTable()
|
||||
{
|
||||
return $this->_bordersHashTable;
|
||||
}
|
||||
|
||||
@ -488,7 +494,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getNumFmtHashTable() {
|
||||
public function getNumFmtHashTable()
|
||||
{
|
||||
return $this->_numFmtHashTable;
|
||||
}
|
||||
|
||||
@ -497,7 +504,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return PHPExcel_HashTable
|
||||
*/
|
||||
public function getDrawingHashTable() {
|
||||
public function getDrawingHashTable()
|
||||
{
|
||||
return $this->_drawingHashTable;
|
||||
}
|
||||
|
||||
@ -506,7 +514,8 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getOffice2003Compatibility() {
|
||||
public function getOffice2003Compatibility()
|
||||
{
|
||||
return $this->_office2003compatibility;
|
||||
}
|
||||
|
||||
@ -516,9 +525,9 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
|
||||
* @param boolean $pValue Office2003 compatibility?
|
||||
* @return PHPExcel_Writer_Excel2007
|
||||
*/
|
||||
public function setOffice2003Compatibility($pValue = false) {
|
||||
public function setOffice2003Compatibility($pValue = false)
|
||||
{
|
||||
$this->_office2003compatibility = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,9 +32,7 @@
|
||||
* @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 {
|
||||
/**
|
||||
* Write charts to XML format
|
||||
*
|
||||
@ -43,14 +41,11 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeChart(PHPExcel_Chart $pChart = NULL) {
|
||||
public function writeChart(PHPExcel_Chart $pChart = null) {
|
||||
// Create XML writer
|
||||
$objWriter = NULL;
|
||||
if ($this->getParentWriter()
|
||||
->getUseDiskCaching()
|
||||
) {
|
||||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()
|
||||
->getDiskCachingDirectory());
|
||||
$objWriter = null;
|
||||
if ($this->getParentWriter()->getUseDiskCaching()) {
|
||||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
|
||||
} else {
|
||||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
|
||||
}
|
||||
@ -86,17 +81,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
$objWriter->writeAttribute('val', 0);
|
||||
$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);
|
||||
|
||||
@ -130,7 +115,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
*
|
||||
* @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)) {
|
||||
return;
|
||||
}
|
||||
@ -151,16 +136,13 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
if ((is_array($caption)) && (count($caption) > 0)) {
|
||||
$caption = $caption[0];
|
||||
}
|
||||
$this->getParentWriter()
|
||||
->getWriterPart('stringtable')
|
||||
->writeRichTextForCharts($objWriter, $caption, 'a');
|
||||
$this->getParentWriter()->getWriterPart('stringtable')->writeRichTextForCharts($objWriter, $caption, 'a');
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$layout = $title->getLayout();
|
||||
$this->_writeLayout($layout, $objWriter);
|
||||
$this->_writeLayout($title->getLayout(), $objWriter);
|
||||
|
||||
$objWriter->startElement('c:overlay');
|
||||
$objWriter->writeAttribute('val', 0);
|
||||
@ -177,7 +159,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
*
|
||||
* @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)) {
|
||||
return;
|
||||
}
|
||||
@ -188,8 +170,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
$objWriter->writeAttribute('val', $legend->getPosition());
|
||||
$objWriter->endElement();
|
||||
|
||||
$layout = $legend->getLayout();
|
||||
$this->_writeLayout($layout, $objWriter);
|
||||
$this->_writeLayout($legend->getLayout(), $objWriter);
|
||||
|
||||
$objWriter->startElement('c:overlay');
|
||||
$objWriter->writeAttribute('val', ($legend->getOverlay()) ? '1' : '0');
|
||||
@ -232,16 +213,8 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
*
|
||||
* @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)) {
|
||||
return;
|
||||
}
|
||||
@ -255,7 +228,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
$this->_writeLayout($layout, $objWriter);
|
||||
|
||||
$chartTypes = self::_getChartType($plotArea);
|
||||
$catIsMultiLevelSeries = $valIsMultiLevelSeries = FALSE;
|
||||
$catIsMultiLevelSeries = $valIsMultiLevelSeries = false;
|
||||
$plotGroupingType = '';
|
||||
foreach ($chartTypes as $chartType) {
|
||||
$objWriter->startElement('c:' . $chartType);
|
||||
@ -265,7 +238,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
$plotGroup = $plotArea->getPlotGroupByIndex($i);
|
||||
$groupType = $plotGroup->getPlotType();
|
||||
if ($groupType == $chartType) {
|
||||
|
||||
$plotStyle = $plotGroup->getPlotStyle();
|
||||
if ($groupType === PHPExcel_Chart_DataSeries::TYPE_RADARCHART) {
|
||||
$objWriter->startElement('c:radarStyle');
|
||||
@ -289,24 +261,17 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
$objWriter->startElement('c:smooth');
|
||||
$objWriter->writeAttribute('val', (integer) $plotGroup->getSmoothLine());
|
||||
$objWriter->endElement();
|
||||
} elseif (($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||
|
||||
($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)
|
||||
) {
|
||||
|
||||
} elseif (($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) {
|
||||
$objWriter->startElement('c:gapWidth');
|
||||
$objWriter->writeAttribute('val', 150);
|
||||
$objWriter->endElement();
|
||||
|
||||
if ($plotGroupingType == 'percentStacked' ||
|
||||
$plotGroupingType == 'stacked'
|
||||
) {
|
||||
|
||||
if ($plotGroupingType == 'percentStacked' || $plotGroupingType == 'stacked') {
|
||||
$objWriter->startElement('c:overlap');
|
||||
$objWriter->writeAttribute('val', 100);
|
||||
$objWriter->endElement();
|
||||
}
|
||||
} elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
|
||||
|
||||
$objWriter->startElement('c:bubbleScale');
|
||||
$objWriter->writeAttribute('val', 25);
|
||||
$objWriter->endElement();
|
||||
@ -315,7 +280,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
$objWriter->writeAttribute('val', 0);
|
||||
$objWriter->endElement();
|
||||
} elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) {
|
||||
|
||||
$objWriter->startElement('c:hiLowLines');
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -342,11 +306,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
$id1 = '75091328';
|
||||
$id2 = '75089408';
|
||||
|
||||
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)) {
|
||||
$objWriter->startElement('c:axId');
|
||||
$objWriter->writeAttribute('val', $id1);
|
||||
$objWriter->endElement();
|
||||
@ -359,7 +319,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
$objWriter->endElement();
|
||||
|
||||
if ($chartType === PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) {
|
||||
|
||||
$objWriter->startElement('c:holeSize');
|
||||
$objWriter->writeAttribute('val', 50);
|
||||
$objWriter->endElement();
|
||||
@ -369,11 +328,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
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) {
|
||||
$this->_writeValAx($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines);
|
||||
} else {
|
||||
@ -507,7 +462,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
}
|
||||
|
||||
$objWriter->startElement('c:numFmt');
|
||||
@ -820,7 +774,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
}
|
||||
|
||||
if (!is_null($yAxisLabel)) {
|
||||
|
||||
$objWriter->startElement('c:title');
|
||||
$objWriter->startElement('c:tx');
|
||||
$objWriter->startElement('c:rich');
|
||||
@ -1030,7 +983,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
$objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('minor_unit'));
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($isMultiLevelSeries) {
|
||||
@ -1042,7 +994,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1053,20 +1004,15 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
* @return string|array
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
private
|
||||
static function _getChartType($plotArea) {
|
||||
private static function _getChartType($plotArea) {
|
||||
$groupCount = $plotArea->getPlotGroupCount();
|
||||
|
||||
if ($groupCount == 1) {
|
||||
$chartType = array(
|
||||
$plotArea->getPlotGroupByIndex(0)
|
||||
->getPlotType()
|
||||
);
|
||||
$chartType = array($plotArea->getPlotGroupByIndex(0)->getPlotType());
|
||||
} else {
|
||||
$chartTypes = array();
|
||||
for ($i = 0; $i < $groupCount; ++$i) {
|
||||
$chartTypes[] = $plotArea->getPlotGroupByIndex($i)
|
||||
->getPlotType();
|
||||
$chartTypes[] = $plotArea->getPlotGroupByIndex($i)->getPlotType();
|
||||
}
|
||||
$chartType = array_unique($chartTypes);
|
||||
if (count($chartTypes) == 0) {
|
||||
@ -1090,21 +1036,12 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
*
|
||||
* @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)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||
|
||||
($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)
|
||||
) {
|
||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) {
|
||||
$objWriter->startElement('c:barDir');
|
||||
$objWriter->writeAttribute('val', $plotGroup->getPlotDirection());
|
||||
$objWriter->endElement();
|
||||
@ -1121,16 +1058,9 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
$plotSeriesOrder = $plotGroup->getPlotOrder();
|
||||
$plotSeriesCount = count($plotSeriesOrder);
|
||||
|
||||
if (($groupType !== PHPExcel_Chart_DataSeries::TYPE_RADARCHART) &&
|
||||
($groupType !== PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)
|
||||
) {
|
||||
|
||||
if (($groupType !== PHPExcel_Chart_DataSeries::TYPE_RADARCHART) && ($groupType !== PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) {
|
||||
if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_LINECHART) {
|
||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) ||
|
||||
($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) ||
|
||||
($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) ||
|
||||
($plotSeriesCount > 1)
|
||||
) {
|
||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) || ($plotSeriesCount > 1)) {
|
||||
$objWriter->startElement('c:varyColors');
|
||||
$objWriter->writeAttribute('val', 1);
|
||||
$objWriter->endElement();
|
||||
@ -1153,11 +1083,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
$objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesRef);
|
||||
$objWriter->endElement();
|
||||
|
||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) ||
|
||||
($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) ||
|
||||
($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)
|
||||
) {
|
||||
|
||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
|
||||
$objWriter->startElement('c:dPt');
|
||||
$objWriter->startElement('c:idx');
|
||||
$objWriter->writeAttribute('val', 3);
|
||||
@ -1188,9 +1114,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
}
|
||||
|
||||
// Formatting for the points
|
||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_LINECHART) ||
|
||||
($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)
|
||||
) {
|
||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_LINECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) {
|
||||
$objWriter->startElement('c:spPr');
|
||||
$objWriter->startElement('a:ln');
|
||||
$objWriter->writeAttribute('w', 12700);
|
||||
@ -1221,11 +1145,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
}
|
||||
}
|
||||
|
||||
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||
|
||||
($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D) ||
|
||||
($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART)
|
||||
) {
|
||||
|
||||
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART)) {
|
||||
$objWriter->startElement('c:invertIfNegative');
|
||||
$objWriter->writeAttribute('val', 0);
|
||||
$objWriter->endElement();
|
||||
@ -1236,11 +1156,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
if ($plotSeriesCategory && ($plotSeriesCategory->getPointCount() > 0)) {
|
||||
$catIsMultiLevelSeries = $catIsMultiLevelSeries || $plotSeriesCategory->isMultiLevelSeries();
|
||||
|
||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) ||
|
||||
($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) ||
|
||||
($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)
|
||||
) {
|
||||
|
||||
if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
|
||||
if (!is_null($plotGroup->getPlotStyle())) {
|
||||
$plotStyle = $plotGroup->getPlotStyle();
|
||||
if ($plotStyle) {
|
||||
@ -1251,9 +1167,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
}
|
||||
}
|
||||
|
||||
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) ||
|
||||
($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)
|
||||
) {
|
||||
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) {
|
||||
$objWriter->startElement('c:xVal');
|
||||
} else {
|
||||
$objWriter->startElement('c:cat');
|
||||
@ -1267,9 +1181,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
if ($plotSeriesValues) {
|
||||
$valIsMultiLevelSeries = $valIsMultiLevelSeries || $plotSeriesValues->isMultiLevelSeries();
|
||||
|
||||
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) ||
|
||||
($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)
|
||||
) {
|
||||
if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) {
|
||||
$objWriter->startElement('c:yVal');
|
||||
} else {
|
||||
$objWriter->startElement('c:val');
|
||||
@ -1284,7 +1196,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
}
|
||||
|
||||
$this->_seriesIndex += $plotSeriesIdx + 1;
|
||||
@ -1322,7 +1233,6 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
$objWriter->endElement();
|
||||
}
|
||||
$objWriter->endElement();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1336,12 +1246,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
*
|
||||
* @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)) {
|
||||
return;
|
||||
}
|
||||
@ -1391,14 +1296,8 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
|
||||
$objWriter->startElement('c:' . $dataType . 'Cache');
|
||||
|
||||
if (($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART) &&
|
||||
($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) &&
|
||||
($groupType != PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)
|
||||
) {
|
||||
|
||||
if (($plotSeriesValues->getFormatCode() !== NULL) &&
|
||||
($plotSeriesValues->getFormatCode() !== '')
|
||||
) {
|
||||
if (($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($groupType != PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
|
||||
if (($plotSeriesValues->getFormatCode() !== null) && ($plotSeriesValues->getFormatCode() !== '')) {
|
||||
$objWriter->startElement('c:formatCode');
|
||||
$objWriter->writeRawData($plotSeriesValues->getFormatCode());
|
||||
$objWriter->endElement();
|
||||
@ -1484,7 +1383,7 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
*
|
||||
* @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');
|
||||
|
||||
if (!is_null($layout)) {
|
||||
@ -1602,5 +1501,4 @@ class PHPExcel_Writer_Excel2007_Chart extends
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeContentTypes(PHPExcel $pPHPExcel = null, $includeCharts = FALSE)
|
||||
public function writeContentTypes(PHPExcel $pPHPExcel = null, $includeCharts = false)
|
||||
{
|
||||
// Create XML writer
|
||||
$objWriter = null;
|
||||
@ -61,80 +61,52 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types');
|
||||
|
||||
// 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
|
||||
$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
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml'
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml');
|
||||
|
||||
// XML
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, 'xml', 'application/xml'
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, 'xml', 'application/xml');
|
||||
|
||||
// VML
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing');
|
||||
|
||||
// Workbook
|
||||
if ($pPHPExcel->hasMacros()) { //Macros in workbook ?
|
||||
// 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
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, 'bin', 'application/vnd.ms-office.vbaProject'
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, 'bin', 'application/vnd.ms-office.vbaProject');
|
||||
if ($pPHPExcel->hasMacrosCertificate()) {// signed macros ?
|
||||
// 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
|
||||
$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
|
||||
$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();
|
||||
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
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
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
|
||||
$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
|
||||
$chart = 1;
|
||||
@ -145,17 +117,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
|
||||
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 ($chartCount > 0) {
|
||||
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');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,9 +131,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
// Comments
|
||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,9 +156,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
if (!isset( $aMediaContentTypes[$extension]) ) {
|
||||
$aMediaContentTypes[$extension] = $mimeType;
|
||||
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, $extension, $mimeType
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, $extension, $mimeType);
|
||||
}
|
||||
}
|
||||
if ($pPHPExcel->hasRibbonBinObjects()) {//Some additional objects in the ribbon ?
|
||||
@ -200,9 +164,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
$tabRibbonTypes=array_diff($pPHPExcel->getRibbonBinObjects('types'), array_keys($aMediaContentTypes));
|
||||
foreach ($tabRibbonTypes as $aRibbonType) {
|
||||
$mimeType='image/.'.$aRibbonType;//we wrote $mimeType like customUI Editor
|
||||
$this->_writeDefaultContentType(
|
||||
$objWriter, $aRibbonType, $mimeType
|
||||
);
|
||||
$this->_writeDefaultContentType($objWriter, $aRibbonType, $mimeType);
|
||||
}
|
||||
}
|
||||
$sheetCount = $pPHPExcel->getSheetCount();
|
||||
@ -212,9 +174,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
|
||||
if (!isset( $aMediaContentTypes[strtolower($image->getExtension())])) {
|
||||
$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())]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -268,5 +268,4 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
|
||||
// Return
|
||||
return $objWriter->getData();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
$pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_PATH) {
|
||||
// Gradient fill
|
||||
$this->_writeGradientFill($objWriter, $pFill);
|
||||
} elseif($pFill->getFillType() !== NULL) {
|
||||
} elseif ($pFill->getFillType() !== null) {
|
||||
// Pattern fill
|
||||
$this->_writePatternFill($objWriter, $pFill);
|
||||
}
|
||||
@ -285,60 +285,60 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
// Bold. We explicitly write this element also when false (like MS Office Excel 2007 does
|
||||
// for conditional formatting). Otherwise it will apparently not be picked up in conditional
|
||||
// formatting style dialog
|
||||
if ($pFont->getBold() !== NULL) {
|
||||
if ($pFont->getBold() !== null) {
|
||||
$objWriter->startElement('b');
|
||||
$objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Italic
|
||||
if ($pFont->getItalic() !== NULL) {
|
||||
if ($pFont->getItalic() !== null) {
|
||||
$objWriter->startElement('i');
|
||||
$objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Strikethrough
|
||||
if ($pFont->getStrikethrough() !== NULL) {
|
||||
if ($pFont->getStrikethrough() !== null) {
|
||||
$objWriter->startElement('strike');
|
||||
$objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Underline
|
||||
if ($pFont->getUnderline() !== NULL) {
|
||||
if ($pFont->getUnderline() !== null) {
|
||||
$objWriter->startElement('u');
|
||||
$objWriter->writeAttribute('val', $pFont->getUnderline());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Superscript / subscript
|
||||
if ($pFont->getSuperScript() === TRUE || $pFont->getSubScript() === TRUE) {
|
||||
if ($pFont->getSuperScript() === true || $pFont->getSubScript() === true) {
|
||||
$objWriter->startElement('vertAlign');
|
||||
if ($pFont->getSuperScript() === TRUE) {
|
||||
if ($pFont->getSuperScript() === true) {
|
||||
$objWriter->writeAttribute('val', 'superscript');
|
||||
} else if ($pFont->getSubScript() === TRUE) {
|
||||
} else if ($pFont->getSubScript() === true) {
|
||||
$objWriter->writeAttribute('val', 'subscript');
|
||||
}
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Size
|
||||
if ($pFont->getSize() !== NULL) {
|
||||
if ($pFont->getSize() !== null) {
|
||||
$objWriter->startElement('sz');
|
||||
$objWriter->writeAttribute('val', $pFont->getSize());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Foreground color
|
||||
if ($pFont->getColor()->getARGB() !== NULL) {
|
||||
if ($pFont->getColor()->getARGB() !== null) {
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Name
|
||||
if ($pFont->getName() !== NULL) {
|
||||
if ($pFont->getName() !== null) {
|
||||
$objWriter->startElement('name');
|
||||
$objWriter->writeAttribute('val', $pFont->getName());
|
||||
$objWriter->endElement();
|
||||
@ -482,14 +482,14 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
|
||||
// alignment
|
||||
$objWriter->startElement('alignment');
|
||||
if ($pStyle->getAlignment()->getHorizontal() !== NULL) {
|
||||
if ($pStyle->getAlignment()->getHorizontal() !== null) {
|
||||
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
|
||||
}
|
||||
if ($pStyle->getAlignment()->getVertical() !== NULL) {
|
||||
if ($pStyle->getAlignment()->getVertical() !== null) {
|
||||
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
|
||||
}
|
||||
|
||||
if ($pStyle->getAlignment()->getTextRotation() !== NULL) {
|
||||
if ($pStyle->getAlignment()->getTextRotation() !== null) {
|
||||
$textRotation = 0;
|
||||
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
|
||||
$textRotation = $pStyle->getAlignment()->getTextRotation();
|
||||
@ -504,16 +504,15 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
$this->_writeBorder($objWriter, $pStyle->getBorders());
|
||||
|
||||
// protection
|
||||
if (($pStyle->getProtection()->getLocked() !== NULL) ||
|
||||
($pStyle->getProtection()->getHidden() !== NULL)) {
|
||||
if (($pStyle->getProtection()->getLocked() !== null) || ($pStyle->getProtection()->getHidden() !== null)) {
|
||||
if ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT ||
|
||||
$pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->startElement('protection');
|
||||
if (($pStyle->getProtection()->getLocked() !== NULL) &&
|
||||
if (($pStyle->getProtection()->getLocked() !== null) &&
|
||||
($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
|
||||
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
if (($pStyle->getProtection()->getHidden() !== NULL) &&
|
||||
if (($pStyle->getProtection()->getHidden() !== null) &&
|
||||
($pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
|
||||
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
@ -562,7 +561,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
$formatCode = $pNumberFormat->getFormatCode();
|
||||
|
||||
// numFmt
|
||||
if ($formatCode !== NULL) {
|
||||
if ($formatCode !== null) {
|
||||
$objWriter->startElement('numFmt');
|
||||
$objWriter->writeAttribute('numFmtId', ($pId + 164));
|
||||
$objWriter->writeAttribute('formatCode', $formatCode);
|
||||
@ -579,9 +578,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
*/
|
||||
public function allStyles(PHPExcel $pPHPExcel = null)
|
||||
{
|
||||
$aStyles = $pPHPExcel->getCellXfCollection();
|
||||
|
||||
return $aStyles;
|
||||
return $pPHPExcel->getCellXfCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -845,7 +845,6 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
$objWriter->writeAttribute('typeface', $typeface);
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -866,6 +865,5 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeWorkbook(PHPExcel $pPHPExcel = null, $recalcRequired = FALSE)
|
||||
public function writeWorkbook(PHPExcel $pPHPExcel = null, $recalcRequired = false)
|
||||
{
|
||||
// Create XML writer
|
||||
$objWriter = null;
|
||||
@ -190,7 +190,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||
* @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing
|
||||
* @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');
|
||||
|
||||
|
@ -679,21 +679,18 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||
} elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x0B) { // Boolean
|
||||
} elseif ($dataProp['type']['data'] == 0x0B) { // Boolean
|
||||
if ($dataProp['data']['data'] == false) {
|
||||
$dataSection_Content .= pack('V', 0x0000);
|
||||
} else {
|
||||
$dataSection_Content .= pack('V', 0x0001);
|
||||
}
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||
} elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||
// Null-terminated string
|
||||
$dataProp['data']['data'] .= chr(0);
|
||||
$dataProp['data']['length'] += 1;
|
||||
@ -705,13 +702,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
} elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
$dataSection_Content_Offset += 4 + 8;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Data Type Not Used at the moment
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
@ -867,13 +862,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||
} elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||
} elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||
// Null-terminated string
|
||||
$dataProp['data']['data'] .= chr(0);
|
||||
$dataProp['data']['length'] += 1;
|
||||
@ -885,13 +878,11 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
|
||||
}
|
||||
elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
} elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
$dataSection_Content_Offset += 4 + 8;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Data Type Not Used at the moment
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user