diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:12:17 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:12:17 +0200 |
commit | f1ab2f022fdc780aca0944d90e9a0e844a0820d7 (patch) | |
tree | 79942a40514f5ab40c5901349c9fcd30c6c8dc0e /admin/survey/excel/PHPExcel/Writer/Excel2007 | |
parent | 2024-02-19 upstream (diff) | |
download | 1ka-master.tar 1ka-master.tar.gz 1ka-master.tar.bz2 1ka-master.tar.lz 1ka-master.tar.xz 1ka-master.tar.zst 1ka-master.zip |
Diffstat (limited to 'admin/survey/excel/PHPExcel/Writer/Excel2007')
12 files changed, 0 insertions, 6636 deletions
diff --git a/admin/survey/excel/PHPExcel/Writer/Excel2007/Chart.php b/admin/survey/excel/PHPExcel/Writer/Excel2007/Chart.php deleted file mode 100644 index 1b54f04..0000000 --- a/admin/survey/excel/PHPExcel/Writer/Excel2007/Chart.php +++ /dev/null @@ -1,1181 +0,0 @@ -<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2012 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
- * @version 1.7.8, 2012-10-12
- */
-
-
-/**
- * PHPExcel_Writer_Excel2007_Chart
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart
-{
- /**
- * Write charts to XML format
- *
- * @param PHPExcel_Chart $pChart
- * @return string XML Output
- * @throws Exception
- */
- 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());
- } else {
- $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
- }
- // Ensure that data series values are up-to-date before we save
- $pChart->refresh();
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // c:chartSpace
- $objWriter->startElement('c:chartSpace');
- $objWriter->writeAttribute('xmlns:c', 'http://schemas.openxmlformats.org/drawingml/2006/chart');
- $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
- $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
-
- $objWriter->startElement('c:date1904');
- $objWriter->writeAttribute('val', 0);
- $objWriter->endElement();
- $objWriter->startElement('c:lang');
- $objWriter->writeAttribute('val', "en-GB");
- $objWriter->endElement();
- $objWriter->startElement('c:roundedCorners');
- $objWriter->writeAttribute('val', 0);
- $objWriter->endElement();
-
- $this->_writeAlternateContent($objWriter);
-
- $objWriter->startElement('c:chart');
-
- $this->_writeTitle($pChart->getTitle(), $objWriter);
-
- $objWriter->startElement('c:autoTitleDeleted');
- $objWriter->writeAttribute('val', 0);
- $objWriter->endElement();
-
- $this->_writePlotArea($pChart->getPlotArea(),
- $pChart->getXAxisLabel(),
- $pChart->getYAxisLabel(),
- $objWriter,
- $pChart->getWorksheet()
- );
-
- $this->_writeLegend($pChart->getLegend(), $objWriter);
-
-
- $objWriter->startElement('c:plotVisOnly');
- $objWriter->writeAttribute('val', 1);
- $objWriter->endElement();
-
- $objWriter->startElement('c:dispBlanksAs');
- $objWriter->writeAttribute('val', "gap");
- $objWriter->endElement();
-
- $objWriter->startElement('c:showDLblsOverMax');
- $objWriter->writeAttribute('val', 0);
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $this->_writePrintSettings($objWriter);
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write Chart Title
- *
- * @param PHPExcel_Chart_Title $title
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @throws Exception
- */
- private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter)
- {
- if (is_null($title)) {
- return;
- }
-
- $objWriter->startElement('c:title');
- $objWriter->startElement('c:tx');
- $objWriter->startElement('c:rich');
-
- $objWriter->startElement('a:bodyPr');
- $objWriter->endElement();
-
- $objWriter->startElement('a:lstStyle');
- $objWriter->endElement();
-
- $objWriter->startElement('a:p');
-
- $caption = $title->getCaption();
- if ((is_array($caption)) && (count($caption) > 0))
- $caption = $caption[0];
- $this->getParentWriter()->getWriterPart('stringtable')->writeRichTextForCharts($objWriter, $caption, 'a');
-
- $objWriter->endElement();
- $objWriter->endElement();
- $objWriter->endElement();
-
- $layout = $title->getLayout();
- $this->_writeLayout($layout, $objWriter);
-
- $objWriter->startElement('c:overlay');
- $objWriter->writeAttribute('val', 0);
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-
- /**
- * Write Chart Legend
- *
- * @param PHPExcel_Chart_Legend $legend
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @throws Exception
- */
- private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter)
- {
- if (is_null($legend)) {
- return;
- }
-
- $objWriter->startElement('c:legend');
-
- $objWriter->startElement('c:legendPos');
- $objWriter->writeAttribute('val', $legend->getPosition());
- $objWriter->endElement();
-
- $layout = $legend->getLayout();
- $this->_writeLayout($layout, $objWriter);
-
- $objWriter->startElement('c:overlay');
- $objWriter->writeAttribute('val', ($legend->getOverlay()) ? '1' : '0');
- $objWriter->endElement();
-
- $objWriter->startElement('c:txPr');
- $objWriter->startElement('a:bodyPr');
- $objWriter->endElement();
-
- $objWriter->startElement('a:lstStyle');
- $objWriter->endElement();
-
- $objWriter->startElement('a:p');
- $objWriter->startElement('a:pPr');
- $objWriter->writeAttribute('rtl', 0);
-
- $objWriter->startElement('a:defRPr');
- $objWriter->endElement();
- $objWriter->endElement();
-
- $objWriter->startElement('a:endParaRPr');
- $objWriter->writeAttribute('lang', "en-US");
- $objWriter->endElement();
-
- $objWriter->endElement();
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-
- /**
- * Write Chart Plot Area
- *
- * @param PHPExcel_Chart_PlotArea $plotArea
- * @param PHPExcel_Chart_Title $xAxisLabel
- * @param PHPExcel_Chart_Title $yAxisLabel
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @throws Exception
- */
- private function _writePlotArea(PHPExcel_Chart_PlotArea $plotArea,
- PHPExcel_Chart_Title $xAxisLabel = NULL,
- PHPExcel_Chart_Title $yAxisLabel = NULL,
- $objWriter,
- PHPExcel_Worksheet $pSheet)
- {
- if (is_null($plotArea)) {
- return;
- }
-
- $id1 = $id2 = 0;
- $objWriter->startElement('c:plotArea');
-
- $layout = $plotArea->getLayout();
-
- $this->_writeLayout($layout, $objWriter);
-
- $chartTypes = self::_getChartType($plotArea);
- $catIsMultiLevelSeries = $valIsMultiLevelSeries = FALSE;
- $plotGroupingType = '';
- foreach($chartTypes as $chartType) {
- $objWriter->startElement('c:'.$chartType);
-
- $groupCount = $plotArea->getPlotGroupCount();
- for($i = 0; $i < $groupCount; ++$i) {
- $plotGroup = $plotArea->getPlotGroupByIndex($i);
- $groupType = $plotGroup->getPlotType();
- if ($groupType == $chartType) {
-
- $plotStyle = $plotGroup->getPlotStyle();
- if ($groupType === PHPExcel_Chart_DataSeries::TYPE_RADARCHART) {
- $objWriter->startElement('c:radarStyle');
- $objWriter->writeAttribute('val', $plotStyle );
- $objWriter->endElement();
- } elseif ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART) {
- $objWriter->startElement('c:scatterStyle');
- $objWriter->writeAttribute('val', $plotStyle );
- $objWriter->endElement();
- }
-
- $this->_writePlotGroup($plotGroup, $chartType, $objWriter, $catIsMultiLevelSeries, $valIsMultiLevelSeries, $plotGroupingType, $pSheet);
- }
- }
-
- $this->_writeDataLbls($objWriter, $layout);
-
- if ($chartType === PHPExcel_Chart_DataSeries::TYPE_LINECHART) {
- // Line only, Line3D can't be smoothed
-
- $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)) {
-
- $objWriter->startElement('c:gapWidth');
- $objWriter->writeAttribute('val', 150 );
- $objWriter->endElement();
-
- 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();
-
- $objWriter->startElement('c:showNegBubbles');
- $objWriter->writeAttribute('val', 0 );
- $objWriter->endElement();
- } elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) {
-
- $objWriter->startElement('c:hiLowLines');
- $objWriter->endElement();
- }
-
- // Generate 2 unique numbers to use for axId values
-// $id1 = $id2 = rand(10000000,99999999);
-// do {
-// $id2 = rand(10000000,99999999);
-// } while ($id1 == $id2);
- $id1 = '75091328';
- $id2 = '75089408';
-
- 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();
- $objWriter->startElement('c:axId');
- $objWriter->writeAttribute('val', $id2 );
- $objWriter->endElement();
- } else {
- $objWriter->startElement('c:firstSliceAng');
- $objWriter->writeAttribute('val', 0);
- $objWriter->endElement();
-
- if ($chartType === PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) {
-
- $objWriter->startElement('c:holeSize');
- $objWriter->writeAttribute('val', 50);
- $objWriter->endElement();
- }
- }
-
- $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_BUBBLECHART) {
- $this->_writeValAx($objWriter,$plotArea,$xAxisLabel,$chartType,$id1,$id2,$catIsMultiLevelSeries);
- } else {
- $this->_writeCatAx($objWriter,$plotArea,$xAxisLabel,$chartType,$id1,$id2,$catIsMultiLevelSeries);
- }
-
- $this->_writeValAx($objWriter,$plotArea,$yAxisLabel,$chartType,$id1,$id2,$valIsMultiLevelSeries);
- }
-
- $objWriter->endElement();
- }
-
- /**
- * Write Data Labels
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Chart_Layout $chartLayout Chart layout
- * @throws Exception
- */
- private function _writeDataLbls($objWriter, $chartLayout)
- {
- $objWriter->startElement('c:dLbls');
-
- $objWriter->startElement('c:showLegendKey');
- $showLegendKey = (empty($chartLayout)) ? 0 : $chartLayout->getShowLegendKey();
- $objWriter->writeAttribute('val', ((empty($showLegendKey)) ? 0 : 1) );
- $objWriter->endElement();
-
-
- $objWriter->startElement('c:showVal');
- $showVal = (empty($chartLayout)) ? 0 : $chartLayout->getShowVal();
- $objWriter->writeAttribute('val', ((empty($showVal)) ? 0 : 1) );
- $objWriter->endElement();
-
- $objWriter->startElement('c:showCatName');
- $showCatName = (empty($chartLayout)) ? 0 : $chartLayout->getShowCatName();
- $objWriter->writeAttribute('val', ((empty($showCatName)) ? 0 : 1) );
- $objWriter->endElement();
-
- $objWriter->startElement('c:showSerName');
- $showSerName = (empty($chartLayout)) ? 0 : $chartLayout->getShowSerName();
- $objWriter->writeAttribute('val', ((empty($showSerName)) ? 0 : 1) );
- $objWriter->endElement();
-
- $objWriter->startElement('c:showPercent');
- $showPercent = (empty($chartLayout)) ? 0 : $chartLayout->getShowPercent();
- $objWriter->writeAttribute('val', ((empty($showPercent)) ? 0 : 1) );
- $objWriter->endElement();
-
- $objWriter->startElement('c:showBubbleSize');
- $showBubbleSize = (empty($chartLayout)) ? 0 : $chartLayout->getShowBubbleSize();
- $objWriter->writeAttribute('val', ((empty($showBubbleSize)) ? 0 : 1) );
- $objWriter->endElement();
-
- $objWriter->startElement('c:showLeaderLines');
- $showLeaderLines = (empty($chartLayout)) ? 1 : $chartLayout->getShowLeaderLines();
- $objWriter->writeAttribute('val', ((empty($showLeaderLines)) ? 0 : 1) );
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-
- /**
- * Write Category Axis
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Chart_PlotArea $plotArea
- * @param PHPExcel_Chart_Title $xAxisLabel
- * @param string $groupType Chart type
- * @param string $id1
- * @param string $id2
- * @param boolean $isMultiLevelSeries
- * @throws Exception
- */
- private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries)
- {
- $objWriter->startElement('c:catAx');
-
- if ($id1 > 0) {
- $objWriter->startElement('c:axId');
- $objWriter->writeAttribute('val', $id1);
- $objWriter->endElement();
- }
-
- $objWriter->startElement('c:scaling');
- $objWriter->startElement('c:orientation');
- $objWriter->writeAttribute('val', "minMax");
- $objWriter->endElement();
- $objWriter->endElement();
-
- $objWriter->startElement('c:delete');
- $objWriter->writeAttribute('val', 0);
- $objWriter->endElement();
-
- $objWriter->startElement('c:axPos');
- $objWriter->writeAttribute('val', "b");
- $objWriter->endElement();
-
- if (!is_null($xAxisLabel)) {
- $objWriter->startElement('c:title');
- $objWriter->startElement('c:tx');
- $objWriter->startElement('c:rich');
-
- $objWriter->startElement('a:bodyPr');
- $objWriter->endElement();
-
- $objWriter->startElement('a:lstStyle');
- $objWriter->endElement();
-
- $objWriter->startElement('a:p');
- $objWriter->startElement('a:r');
-
- $caption = $xAxisLabel->getCaption();
- if (is_array($caption))
- $caption = $caption[0];
- $objWriter->startElement('a:t');
-// $objWriter->writeAttribute('xml:space', 'preserve');
- $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $caption ));
- $objWriter->endElement();
-
- $objWriter->endElement();
- $objWriter->endElement();
- $objWriter->endElement();
- $objWriter->endElement();
-
- $objWriter->startElement('c:overlay');
- $objWriter->writeAttribute('val', 0);
- $objWriter->endElement();
-
- $layout = $xAxisLabel->getLayout();
- $this->_writeLayout($layout, $objWriter);
-
- $objWriter->endElement();
-
- }
-
- $objWriter->startElement('c:numFmt');
- $objWriter->writeAttribute('formatCode', "General");
- $objWriter->writeAttribute('sourceLinked', 1);
- $objWriter->endElement();
-
- $objWriter->startElement('c:majorTickMark');
- $objWriter->writeAttribute('val', "out");
- $objWriter->endElement();
-
- $objWriter->startElement('c:minorTickMark');
- $objWriter->writeAttribute('val', "none");
- $objWriter->endElement();
-
- $objWriter->startElement('c:tickLblPos');
- $objWriter->writeAttribute('val', "nextTo");
- $objWriter->endElement();
-
- if ($id2 > 0) {
- $objWriter->startElement('c:crossAx');
- $objWriter->writeAttribute('val', $id2);
- $objWriter->endElement();
-
- $objWriter->startElement('c:crosses');
- $objWriter->writeAttribute('val', "autoZero");
- $objWriter->endElement();
- }
-
- $objWriter->startElement('c:auto');
- $objWriter->writeAttribute('val', 1);
- $objWriter->endElement();
-
- $objWriter->startElement('c:lblAlgn');
- $objWriter->writeAttribute('val', "ctr");
- $objWriter->endElement();
-
- $objWriter->startElement('c:lblOffset');
- $objWriter->writeAttribute('val', 100);
- $objWriter->endElement();
-
- if ($isMultiLevelSeries) {
- $objWriter->startElement('c:noMultiLvlLbl');
- $objWriter->writeAttribute('val', 0);
- $objWriter->endElement();
- }
- $objWriter->endElement();
-
- }
-
-
- /**
- * Write Value Axis
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Chart_PlotArea $plotArea
- * @param PHPExcel_Chart_Title $yAxisLabel
- * @param string $groupType Chart type
- * @param string $id1
- * @param string $id2
- * @param boolean $isMultiLevelSeries
- * @throws Exception
- */
- private function _writeValAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries)
- {
- $objWriter->startElement('c:valAx');
-
- if ($id2 > 0) {
- $objWriter->startElement('c:axId');
- $objWriter->writeAttribute('val', $id2);
- $objWriter->endElement();
- }
-
- $objWriter->startElement('c:scaling');
- $objWriter->startElement('c:orientation');
- $objWriter->writeAttribute('val', "minMax");
- $objWriter->endElement();
- $objWriter->endElement();
-
- $objWriter->startElement('c:delete');
- $objWriter->writeAttribute('val', 0);
- $objWriter->endElement();
-
- $objWriter->startElement('c:axPos');
- $objWriter->writeAttribute('val', "l");
- $objWriter->endElement();
-
- $objWriter->startElement('c:majorGridlines');
- $objWriter->endElement();
-
- if (!is_null($yAxisLabel)) {
- $objWriter->startElement('c:title');
- $objWriter->startElement('c:tx');
- $objWriter->startElement('c:rich');
-
- $objWriter->startElement('a:bodyPr');
- $objWriter->endElement();
-
- $objWriter->startElement('a:lstStyle');
- $objWriter->endElement();
-
- $objWriter->startElement('a:p');
- $objWriter->startElement('a:r');
-
- $caption = $yAxisLabel->getCaption();
- if (is_array($caption))
- $caption = $caption[0];
- $objWriter->startElement('a:t');
-// $objWriter->writeAttribute('xml:space', 'preserve');
- $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $caption ));
- $objWriter->endElement();
-
- $objWriter->endElement();
- $objWriter->endElement();
- $objWriter->endElement();
- $objWriter->endElement();
-
- $objWriter->startElement('c:overlay');
- $objWriter->writeAttribute('val', 0);
- $objWriter->endElement();
-
- if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
- $layout = $yAxisLabel->getLayout();
- $this->_writeLayout($layout, $objWriter);
- }
-
- $objWriter->endElement();
- }
-
- $objWriter->startElement('c:numFmt');
- $objWriter->writeAttribute('formatCode', "General");
- $objWriter->writeAttribute('sourceLinked', 1);
- $objWriter->endElement();
-
- $objWriter->startElement('c:majorTickMark');
- $objWriter->writeAttribute('val', "out");
- $objWriter->endElement();
-
- $objWriter->startElement('c:minorTickMark');
- $objWriter->writeAttribute('val', "none");
- $objWriter->endElement();
-
- $objWriter->startElement('c:tickLblPos');
- $objWriter->writeAttribute('val', "nextTo");
- $objWriter->endElement();
-
- if ($id1 > 0) {
- $objWriter->startElement('c:crossAx');
- $objWriter->writeAttribute('val', $id2);
- $objWriter->endElement();
-
- $objWriter->startElement('c:crosses');
- $objWriter->writeAttribute('val', "autoZero");
- $objWriter->endElement();
-
- $objWriter->startElement('c:crossBetween');
- $objWriter->writeAttribute('val', "midCat");
- $objWriter->endElement();
- }
-
- if ($isMultiLevelSeries) {
- if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
- $objWriter->startElement('c:noMultiLvlLbl');
- $objWriter->writeAttribute('val', 0);
- $objWriter->endElement();
- }
- }
- $objWriter->endElement();
-
- }
-
-
- /**
- * Get the data series type(s) for a chart plot series
- *
- * @param PHPExcel_Chart_PlotArea $plotArea
- * @return string|array
- * @throws Exception
- */
- private static function _getChartType($plotArea)
- {
- $groupCount = $plotArea->getPlotGroupCount();
-
- if ($groupCount == 1) {
- $chartType = array($plotArea->getPlotGroupByIndex(0)->getPlotType());
- } else {
- $chartTypes = array();
- for($i = 0; $i < $groupCount; ++$i) {
- $chartTypes[] = $plotArea->getPlotGroupByIndex($i)->getPlotType();
- }
- $chartType = array_unique($chartTypes);
- if (count($chartTypes) == 0) {
- throw new Exception('Chart is not yet implemented');
- }
- }
-
- return $chartType;
- }
-
- /**
- * Write Plot Group (series of related plots)
- *
- * @param PHPExcel_Chart_DataSeries $plotGroup
- * @param string $groupType Type of plot for dataseries
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param boolean &$catIsMultiLevelSeries Is category a multi-series category
- * @param boolean &$valIsMultiLevelSeries Is value set a multi-series set
- * @param string &$plotGroupingType Type of grouping for multi-series values
- * @param PHPExcel_Worksheet $pSheet
- * @throws Exception
- */
- 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)) {
- $objWriter->startElement('c:barDir');
- $objWriter->writeAttribute('val', $plotGroup->getPlotDirection());
- $objWriter->endElement();
- }
-
- if (!is_null($plotGroup->getPlotGrouping())) {
- $plotGroupingType = $plotGroup->getPlotGrouping();
- $objWriter->startElement('c:grouping');
- $objWriter->writeAttribute('val', $plotGroupingType);
- $objWriter->endElement();
- }
-
- // Get these details before the loop, because we can use the count to check for varyColors
- $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_LINECHART) {
- 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();
- } else {
- $objWriter->startElement('c:varyColors');
- $objWriter->writeAttribute('val', 0);
- $objWriter->endElement();
- }
- }
- }
-
- foreach($plotSeriesOrder as $plotSeriesIdx => $plotSeriesRef) {
- $objWriter->startElement('c:ser');
-
- $objWriter->startElement('c:idx');
- $objWriter->writeAttribute('val', $plotSeriesIdx);
- $objWriter->endElement();
-
- $objWriter->startElement('c:order');
- $objWriter->writeAttribute('val', $plotSeriesRef);
- $objWriter->endElement();
-
- 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);
- $objWriter->endElement();
-
- $objWriter->startElement('c:bubble3D');
- $objWriter->writeAttribute('val', 0);
- $objWriter->endElement();
-
- $objWriter->startElement('c:spPr');
- $objWriter->startElement('a:solidFill');
- $objWriter->startElement('a:srgbClr');
- $objWriter->writeAttribute('val', 'FF9900');
- $objWriter->endElement();
- $objWriter->endElement();
- $objWriter->endElement();
- $objWriter->endElement();
- }
-
- // Labels
- $plotSeriesLabel = $plotGroup->getPlotLabelByIndex($plotSeriesRef);
- if ($plotSeriesLabel && ($plotSeriesLabel->getPointCount() > 0)) {
- $objWriter->startElement('c:tx');
- $objWriter->startElement('c:strRef');
- $this->_writePlotSeriesLabel($plotSeriesLabel, $objWriter);
- $objWriter->endElement();
- $objWriter->endElement();
- }
-
- // Formatting for the points
- if ($groupType == PHPExcel_Chart_DataSeries::TYPE_LINECHART) {
- $objWriter->startElement('c:spPr');
- $objWriter->startElement('a:ln');
- $objWriter->writeAttribute('w', 12700);
- $objWriter->endElement();
- $objWriter->endElement();
- }
-
- $plotSeriesValues = $plotGroup->getPlotValuesByIndex($plotSeriesRef);
- if ($plotSeriesValues) {
- $plotSeriesMarker = $plotSeriesValues->getPointMarker();
- if ($plotSeriesMarker) {
- $objWriter->startElement('c:marker');
- $objWriter->startElement('c:symbol');
- $objWriter->writeAttribute('val', $plotSeriesMarker);
- $objWriter->endElement();
-
- if ($plotSeriesMarker !== 'none') {
- $objWriter->startElement('c:size');
- $objWriter->writeAttribute('val', 3);
- $objWriter->endElement();
- }
- $objWriter->endElement();
- }
- }
-
- 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();
- }
-
- // Category Labels
- $plotSeriesCategory = $plotGroup->getPlotCategoryByIndex($plotSeriesRef);
- 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 (!is_null($plotGroup->getPlotStyle())) {
- $plotStyle = $plotGroup->getPlotStyle();
- if ($plotStyle) {
- $objWriter->startElement('c:explosion');
- $objWriter->writeAttribute('val', 25);
- $objWriter->endElement();
- }
- }
- }
-
- if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) ||
- ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) {
- $objWriter->startElement('c:xVal');
- } else {
- $objWriter->startElement('c:cat');
- }
-
- $this->_writePlotSeriesValues($plotSeriesCategory, $objWriter, $groupType, 'str', $pSheet);
- $objWriter->endElement();
- }
-
- // Values
- if ($plotSeriesValues) {
- $valIsMultiLevelSeries = $valIsMultiLevelSeries || $plotSeriesValues->isMultiLevelSeries();
-
- if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) ||
- ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) {
- $objWriter->startElement('c:yVal');
- } else {
- $objWriter->startElement('c:val');
- }
-
- $this->_writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, 'num', $pSheet);
- $objWriter->endElement();
- }
-
- if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
- $this->_writeBubbles($plotSeriesValues, $objWriter, $pSheet);
- }
-
- $objWriter->endElement();
-
- }
- }
-
- /**
- * Write Plot Series Label
- *
- * @param PHPExcel_Chart_DataSeriesValues $plotSeriesLabel
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @throws Exception
- */
- private function _writePlotSeriesLabel($plotSeriesLabel, $objWriter)
- {
- if (is_null($plotSeriesLabel)) {
- return;
- }
-
- $objWriter->startElement('c:f');
- $objWriter->writeRawData($plotSeriesLabel->getDataSource());
- $objWriter->endElement();
-
- $objWriter->startElement('c:strCache');
- $objWriter->startElement('c:ptCount');
- $objWriter->writeAttribute('val', $plotSeriesLabel->getPointCount() );
- $objWriter->endElement();
-
- foreach($plotSeriesLabel->getDataValues() as $plotLabelKey => $plotLabelValue) {
- $objWriter->startElement('c:pt');
- $objWriter->writeAttribute('idx', $plotLabelKey );
-
- $objWriter->startElement('c:v');
- $objWriter->writeRawData( $plotLabelValue );
- $objWriter->endElement();
- $objWriter->endElement();
- }
- $objWriter->endElement();
-
- }
-
- /**
- * Write Plot Series Values
- *
- * @param PHPExcel_Chart_DataSeriesValues $plotSeriesValues
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param string $groupType Type of plot for dataseries
- * @param string $dataType Datatype of series values
- * @param PHPExcel_Worksheet $pSheet
- * @throws Exception
- */
- private function _writePlotSeriesValues( $plotSeriesValues,
- $objWriter,
- $groupType,
- $dataType='str',
- PHPExcel_Worksheet $pSheet
- )
- {
- if (is_null($plotSeriesValues)) {
- return;
- }
-
- if ($plotSeriesValues->isMultiLevelSeries()) {
- $levelCount = $plotSeriesValues->multiLevelCount();
-
- $objWriter->startElement('c:multiLvlStrRef');
-
- $objWriter->startElement('c:f');
- $objWriter->writeRawData( $plotSeriesValues->getDataSource() );
- $objWriter->endElement();
-
- $objWriter->startElement('c:multiLvlStrCache');
-
- $objWriter->startElement('c:ptCount');
- $objWriter->writeAttribute('val', $plotSeriesValues->getPointCount() );
- $objWriter->endElement();
-
- for ($level = 0; $level < $levelCount; ++$level) {
- $objWriter->startElement('c:lvl');
-
- foreach($plotSeriesValues->getDataValues() as $plotSeriesKey => $plotSeriesValue) {
- if (isset($plotSeriesValue[$level])) {
- $objWriter->startElement('c:pt');
- $objWriter->writeAttribute('idx', $plotSeriesKey );
-
- $objWriter->startElement('c:v');
- $objWriter->writeRawData( $plotSeriesValue[$level] );
- $objWriter->endElement();
- $objWriter->endElement();
- }
- }
-
- $objWriter->endElement();
- }
-
- $objWriter->endElement();
-
- $objWriter->endElement();
- } else {
- $objWriter->startElement('c:'.$dataType.'Ref');
-
- $objWriter->startElement('c:f');
- $objWriter->writeRawData( $plotSeriesValues->getDataSource() );
- $objWriter->endElement();
-
- $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() !== '')) {
- $objWriter->startElement('c:formatCode');
- $objWriter->writeRawData( $plotSeriesValues->getFormatCode() );
- $objWriter->endElement();
- }
- }
-
- $objWriter->startElement('c:ptCount');
- $objWriter->writeAttribute('val', $plotSeriesValues->getPointCount() );
- $objWriter->endElement();
-
- $dataValues = $plotSeriesValues->getDataValues();
- if (!empty($dataValues)) {
- if (is_array($dataValues)) {
- foreach($dataValues as $plotSeriesKey => $plotSeriesValue) {
- $objWriter->startElement('c:pt');
- $objWriter->writeAttribute('idx', $plotSeriesKey );
-
- $objWriter->startElement('c:v');
- $objWriter->writeRawData( $plotSeriesValue );
- $objWriter->endElement();
- $objWriter->endElement();
- }
- }
- }
-
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
- }
-
- /**
- * Write Bubble Chart Details
- *
- * @param PHPExcel_Chart_DataSeriesValues $plotSeriesValues
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @throws Exception
- */
- private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet)
- {
- if (is_null($plotSeriesValues)) {
- return;
- }
-
- $objWriter->startElement('c:bubbleSize');
- $objWriter->startElement('c:numLit');
-
- $objWriter->startElement('c:formatCode');
- $objWriter->writeRawData( 'General' );
- $objWriter->endElement();
-
- $objWriter->startElement('c:ptCount');
- $objWriter->writeAttribute('val', $plotSeriesValues->getPointCount() );
- $objWriter->endElement();
-
- $dataValues = $plotSeriesValues->getDataValues();
- if (!empty($dataValues)) {
- if (is_array($dataValues)) {
- foreach($dataValues as $plotSeriesKey => $plotSeriesValue) {
- $objWriter->startElement('c:pt');
- $objWriter->writeAttribute('idx', $plotSeriesKey );
- $objWriter->startElement('c:v');
- $objWriter->writeRawData( 1 );
- $objWriter->endElement();
- $objWriter->endElement();
- }
- }
- }
-
- $objWriter->endElement();
- $objWriter->endElement();
-
- $objWriter->startElement('c:bubble3D');
- $objWriter->writeAttribute('val', 0 );
- $objWriter->endElement();
- }
-
- /**
- * Write Layout
- *
- * @param PHPExcel_Chart_Layout $layout
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @throws Exception
- */
- private function _writeLayout(PHPExcel_Chart_Layout $layout = NULL, $objWriter)
- {
- $objWriter->startElement('c:layout');
-
- if (!is_null($layout)) {
- $objWriter->startElement('c:manualLayout');
-
- $layoutTarget = $layout->getLayoutTarget();
- if (!is_null($layoutTarget)) {
- $objWriter->startElement('c:layoutTarget');
- $objWriter->writeAttribute('val', $layoutTarget);
- $objWriter->endElement();
- }
-
- $xMode = $layout->getXMode();
- if (!is_null($xMode)) {
- $objWriter->startElement('c:xMode');
- $objWriter->writeAttribute('val', $xMode);
- $objWriter->endElement();
- }
-
- $yMode = $layout->getYMode();
- if (!is_null($yMode)) {
- $objWriter->startElement('c:yMode');
- $objWriter->writeAttribute('val', $yMode);
- $objWriter->endElement();
- }
-
- $x = $layout->getXPosition();
- if (!is_null($x)) {
- $objWriter->startElement('c:x');
- $objWriter->writeAttribute('val', $x);
- $objWriter->endElement();
- }
-
- $y = $layout->getYPosition();
- if (!is_null($y)) {
- $objWriter->startElement('c:y');
- $objWriter->writeAttribute('val', $y);
- $objWriter->endElement();
- }
-
- $w = $layout->getWidth();
- if (!is_null($w)) {
- $objWriter->startElement('c:w');
- $objWriter->writeAttribute('val', $w);
- $objWriter->endElement();
- }
-
- $h = $layout->getHeight();
- if (!is_null($h)) {
- $objWriter->startElement('c:h');
- $objWriter->writeAttribute('val', $h);
- $objWriter->endElement();
- }
-
- $objWriter->endElement();
- }
-
- $objWriter->endElement();
- }
-
- /**
- * Write Alternate Content block
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @throws Exception
- */
- private function _writeAlternateContent($objWriter)
- {
- $objWriter->startElement('mc:AlternateContent');
- $objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006');
-
- $objWriter->startElement('mc:Choice');
- $objWriter->writeAttribute('xmlns:c14', 'http://schemas.microsoft.com/office/drawing/2007/8/2/chart');
- $objWriter->writeAttribute('Requires', 'c14');
-
- $objWriter->startElement('c14:style');
- $objWriter->writeAttribute('val', '102');
- $objWriter->endElement();
- $objWriter->endElement();
-
- $objWriter->startElement('mc:Fallback');
- $objWriter->startElement('c:style');
- $objWriter->writeAttribute('val', '2');
- $objWriter->endElement();
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-
- /**
- * Write Printer Settings
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @throws Exception
- */
- private function _writePrintSettings($objWriter)
- {
- $objWriter->startElement('c:printSettings');
-
- $objWriter->startElement('c:headerFooter');
- $objWriter->endElement();
-
- $objWriter->startElement('c:pageMargins');
- $objWriter->writeAttribute('footer', 0.3);
- $objWriter->writeAttribute('header', 0.3);
- $objWriter->writeAttribute('r', 0.7);
- $objWriter->writeAttribute('l', 0.7);
- $objWriter->writeAttribute('t', 0.75);
- $objWriter->writeAttribute('b', 0.75);
- $objWriter->endElement();
-
- $objWriter->startElement('c:pageSetup');
- $objWriter->writeAttribute('orientation', "portrait");
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-
-}
diff --git a/admin/survey/excel/PHPExcel/Writer/Excel2007/Comments.php b/admin/survey/excel/PHPExcel/Writer/Excel2007/Comments.php deleted file mode 100644 index 8c5fb7f..0000000 --- a/admin/survey/excel/PHPExcel/Writer/Excel2007/Comments.php +++ /dev/null @@ -1,268 +0,0 @@ -<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2012 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
- * @version 1.7.8, 2012-10-12
- */
-
-
-/**
- * PHPExcel_Writer_Excel2007_Comments
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_WriterPart
-{
- /**
- * Write comments to XML format
- *
- * @param PHPExcel_Worksheet $pWorksheet
- * @return string XML Output
- * @throws Exception
- */
- public function writeComments(PHPExcel_Worksheet $pWorksheet = null)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // Comments cache
- $comments = $pWorksheet->getComments();
-
- // Authors cache
- $authors = array();
- $authorId = 0;
- foreach ($comments as $comment) {
- if (!isset($authors[$comment->getAuthor()])) {
- $authors[$comment->getAuthor()] = $authorId++;
- }
- }
-
- // comments
- $objWriter->startElement('comments');
- $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
-
- // Loop through authors
- $objWriter->startElement('authors');
- foreach ($authors as $author => $index) {
- $objWriter->writeElement('author', $author);
- }
- $objWriter->endElement();
-
- // Loop through comments
- $objWriter->startElement('commentList');
- foreach ($comments as $key => $value) {
- $this->_writeComment($objWriter, $key, $value, $authors);
- }
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write comment to XML format
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param string $pCellReference Cell reference
- * @param PHPExcel_Comment $pComment Comment
- * @param array $pAuthors Array of authors
- * @throws Exception
- */
- public function _writeComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null, $pAuthors = null)
- {
- // comment
- $objWriter->startElement('comment');
- $objWriter->writeAttribute('ref', $pCellReference);
- $objWriter->writeAttribute('authorId', $pAuthors[$pComment->getAuthor()]);
-
- // text
- $objWriter->startElement('text');
- $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pComment->getText());
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-
- /**
- * Write VML comments to XML format
- *
- * @param PHPExcel_Worksheet $pWorksheet
- * @return string XML Output
- * @throws Exception
- */
- public function writeVMLComments(PHPExcel_Worksheet $pWorksheet = null)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // Comments cache
- $comments = $pWorksheet->getComments();
-
- // xml
- $objWriter->startElement('xml');
- $objWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml');
- $objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
- $objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel');
-
- // o:shapelayout
- $objWriter->startElement('o:shapelayout');
- $objWriter->writeAttribute('v:ext', 'edit');
-
- // o:idmap
- $objWriter->startElement('o:idmap');
- $objWriter->writeAttribute('v:ext', 'edit');
- $objWriter->writeAttribute('data', '1');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // v:shapetype
- $objWriter->startElement('v:shapetype');
- $objWriter->writeAttribute('id', '_x0000_t202');
- $objWriter->writeAttribute('coordsize', '21600,21600');
- $objWriter->writeAttribute('o:spt', '202');
- $objWriter->writeAttribute('path', 'm,l,21600r21600,l21600,xe');
-
- // v:stroke
- $objWriter->startElement('v:stroke');
- $objWriter->writeAttribute('joinstyle', 'miter');
- $objWriter->endElement();
-
- // v:path
- $objWriter->startElement('v:path');
- $objWriter->writeAttribute('gradientshapeok', 't');
- $objWriter->writeAttribute('o:connecttype', 'rect');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // Loop through comments
- foreach ($comments as $key => $value) {
- $this->_writeVMLComment($objWriter, $key, $value);
- }
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write VML comment to XML format
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param string $pCellReference Cell reference
- * @param PHPExcel_Comment $pComment Comment
- * @throws Exception
- */
- public function _writeVMLComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null)
- {
- // Metadata
- list($column, $row) = PHPExcel_Cell::coordinateFromString($pCellReference);
- $column = PHPExcel_Cell::columnIndexFromString($column);
- $id = 1024 + $column + $row;
- $id = substr($id, 0, 4);
-
- // v:shape
- $objWriter->startElement('v:shape');
- $objWriter->writeAttribute('id', '_x0000_s' . $id);
- $objWriter->writeAttribute('type', '#_x0000_t202');
- $objWriter->writeAttribute('style', 'position:absolute;margin-left:' . $pComment->getMarginLeft() . ';margin-top:' . $pComment->getMarginTop() . ';width:' . $pComment->getWidth() . ';height:' . $pComment->getHeight() . ';z-index:1;visibility:' . ($pComment->getVisible() ? 'visible' : 'hidden'));
- $objWriter->writeAttribute('fillcolor', '#' . $pComment->getFillColor()->getRGB());
- $objWriter->writeAttribute('o:insetmode', 'auto');
-
- // v:fill
- $objWriter->startElement('v:fill');
- $objWriter->writeAttribute('color2', '#' . $pComment->getFillColor()->getRGB());
- $objWriter->endElement();
-
- // v:shadow
- $objWriter->startElement('v:shadow');
- $objWriter->writeAttribute('on', 't');
- $objWriter->writeAttribute('color', 'black');
- $objWriter->writeAttribute('obscured', 't');
- $objWriter->endElement();
-
- // v:path
- $objWriter->startElement('v:path');
- $objWriter->writeAttribute('o:connecttype', 'none');
- $objWriter->endElement();
-
- // v:textbox
- $objWriter->startElement('v:textbox');
- $objWriter->writeAttribute('style', 'mso-direction-alt:auto');
-
- // div
- $objWriter->startElement('div');
- $objWriter->writeAttribute('style', 'text-align:left');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // x:ClientData
- $objWriter->startElement('x:ClientData');
- $objWriter->writeAttribute('ObjectType', 'Note');
-
- // x:MoveWithCells
- $objWriter->writeElement('x:MoveWithCells', '');
-
- // x:SizeWithCells
- $objWriter->writeElement('x:SizeWithCells', '');
-
- // x:Anchor
- //$objWriter->writeElement('x:Anchor', $column . ', 15, ' . ($row - 2) . ', 10, ' . ($column + 4) . ', 15, ' . ($row + 5) . ', 18');
-
- // x:AutoFill
- $objWriter->writeElement('x:AutoFill', 'False');
-
- // x:Row
- $objWriter->writeElement('x:Row', ($row - 1));
-
- // x:Column
- $objWriter->writeElement('x:Column', ($column - 1));
-
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-}
diff --git a/admin/survey/excel/PHPExcel/Writer/Excel2007/ContentTypes.php b/admin/survey/excel/PHPExcel/Writer/Excel2007/ContentTypes.php deleted file mode 100644 index 86c6a3f..0000000 --- a/admin/survey/excel/PHPExcel/Writer/Excel2007/ContentTypes.php +++ /dev/null @@ -1,261 +0,0 @@ -<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2012 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
- * @version 1.7.8, 2012-10-12
- */
-
-
-/**
- * PHPExcel_Writer_Excel2007_ContentTypes
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_WriterPart
-{
- /**
- * Write content types to XML format
- *
- * @param PHPExcel $pPHPExcel
- * @param boolean $includeCharts Flag indicating if we should include drawing details for charts
- * @return string XML Output
- * @throws Exception
- */
- public function writeContentTypes(PHPExcel $pPHPExcel = null, $includeCharts = FALSE)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // Types
- $objWriter->startElement('Types');
- $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'
- );
-
- // Styles
- $this->_writeOverrideContentType(
- $objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml'
- );
-
- // Rels
- $this->_writeDefaultContentType(
- $objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml'
- );
-
- // XML
- $this->_writeDefaultContentType(
- $objWriter, 'xml', 'application/xml'
- );
-
- // VML
- $this->_writeDefaultContentType(
- $objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'
- );
-
- // Workbook
- $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/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'
- );
- }
-
- // 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'
- );
- }
-
- // Shared strings
- $this->_writeOverrideContentType(
- $objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml'
- );
-
- // Add worksheet relationship content types
- $chart = 1;
- for ($i = 0; $i < $sheetCount; ++$i) {
- $drawings = $pPHPExcel->getSheet($i)->getDrawingCollection();
- $drawingCount = count($drawings);
- $chartCount = ($includeCharts) ? $pPHPExcel->getSheet($i)->getChartCount() : 0;
-
- // 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'
- );
- }
-
- // 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'
- );
- }
- }
- }
-
- // 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'
- );
- }
- }
-
- // Add media content-types
- $aMediaContentTypes = array();
- $mediaCount = $this->getParentWriter()->getDrawingHashTable()->count();
- for ($i = 0; $i < $mediaCount; ++$i) {
- $extension = '';
- $mimeType = '';
-
- if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) {
- $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension());
- $mimeType = $this->_getImageMimeType( $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath() );
- } else if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
- $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType());
- $extension = explode('/', $extension);
- $extension = $extension[1];
-
- $mimeType = $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType();
- }
-
- if (!isset( $aMediaContentTypes[$extension]) ) {
- $aMediaContentTypes[$extension] = $mimeType;
-
- $this->_writeDefaultContentType(
- $objWriter, $extension, $mimeType
- );
- }
- }
-
- $sheetCount = $pPHPExcel->getSheetCount();
- for ($i = 0; $i < $sheetCount; ++$i) {
- if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) {
- foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) {
- if (!isset( $aMediaContentTypes[strtolower($image->getExtension())]) ) {
- $aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType( $image->getPath() );
-
- $this->_writeDefaultContentType(
- $objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]
- );
- }
- }
- }
- }
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Get image mime type
- *
- * @param string $pFile Filename
- * @return string Mime Type
- * @throws Exception
- */
- private function _getImageMimeType($pFile = '')
- {
- if (PHPExcel_Shared_File::file_exists($pFile)) {
- $image = getimagesize($pFile);
- return image_type_to_mime_type($image[2]);
- } else {
- throw new Exception("File $pFile does not exist");
- }
- }
-
- /**
- * Write Default content type
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param string $pPartname Part name
- * @param string $pContentType Content type
- * @throws Exception
- */
- private function _writeDefaultContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '')
- {
- if ($pPartname != '' && $pContentType != '') {
- // Write content type
- $objWriter->startElement('Default');
- $objWriter->writeAttribute('Extension', $pPartname);
- $objWriter->writeAttribute('ContentType', $pContentType);
- $objWriter->endElement();
- } else {
- throw new Exception("Invalid parameters passed.");
- }
- }
-
- /**
- * Write Override content type
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param string $pPartname Part name
- * @param string $pContentType Content type
- * @throws Exception
- */
- private function _writeOverrideContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '')
- {
- if ($pPartname != '' && $pContentType != '') {
- // Write content type
- $objWriter->startElement('Override');
- $objWriter->writeAttribute('PartName', $pPartname);
- $objWriter->writeAttribute('ContentType', $pContentType);
- $objWriter->endElement();
- } else {
- throw new Exception("Invalid parameters passed.");
- }
- }
-}
diff --git a/admin/survey/excel/PHPExcel/Writer/Excel2007/DocProps.php b/admin/survey/excel/PHPExcel/Writer/Excel2007/DocProps.php deleted file mode 100644 index 8b8b5fe..0000000 --- a/admin/survey/excel/PHPExcel/Writer/Excel2007/DocProps.php +++ /dev/null @@ -1,272 +0,0 @@ -<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2012 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
- * @version 1.7.8, 2012-10-12
- */
-
-
-/**
- * PHPExcel_Writer_Excel2007_DocProps
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_WriterPart
-{
-/**
- * Write docProps/app.xml to XML format
- *
- * @param PHPExcel $pPHPExcel
- * @return string XML Output
- * @throws Exception
- */
- public function writeDocPropsApp(PHPExcel $pPHPExcel = null)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // Properties
- $objWriter->startElement('Properties');
- $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties');
- $objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
-
- // Application
- $objWriter->writeElement('Application', 'Microsoft Excel');
-
- // DocSecurity
- $objWriter->writeElement('DocSecurity', '0');
-
- // ScaleCrop
- $objWriter->writeElement('ScaleCrop', 'false');
-
- // HeadingPairs
- $objWriter->startElement('HeadingPairs');
-
- // Vector
- $objWriter->startElement('vt:vector');
- $objWriter->writeAttribute('size', '2');
- $objWriter->writeAttribute('baseType', 'variant');
-
- // Variant
- $objWriter->startElement('vt:variant');
- $objWriter->writeElement('vt:lpstr', 'Worksheets');
- $objWriter->endElement();
-
- // Variant
- $objWriter->startElement('vt:variant');
- $objWriter->writeElement('vt:i4', $pPHPExcel->getSheetCount());
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // TitlesOfParts
- $objWriter->startElement('TitlesOfParts');
-
- // Vector
- $objWriter->startElement('vt:vector');
- $objWriter->writeAttribute('size', $pPHPExcel->getSheetCount());
- $objWriter->writeAttribute('baseType', 'lpstr');
-
- $sheetCount = $pPHPExcel->getSheetCount();
- for ($i = 0; $i < $sheetCount; ++$i) {
- $objWriter->writeElement('vt:lpstr', $pPHPExcel->getSheet($i)->getTitle());
- }
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // Company
- $objWriter->writeElement('Company', $pPHPExcel->getProperties()->getCompany());
-
- // Company
- $objWriter->writeElement('Manager', $pPHPExcel->getProperties()->getManager());
-
- // LinksUpToDate
- $objWriter->writeElement('LinksUpToDate', 'false');
-
- // SharedDoc
- $objWriter->writeElement('SharedDoc', 'false');
-
- // HyperlinksChanged
- $objWriter->writeElement('HyperlinksChanged', 'false');
-
- // AppVersion
- $objWriter->writeElement('AppVersion', '12.0000');
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write docProps/core.xml to XML format
- *
- * @param PHPExcel $pPHPExcel
- * @return string XML Output
- * @throws Exception
- */
- public function writeDocPropsCore(PHPExcel $pPHPExcel = null)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // cp:coreProperties
- $objWriter->startElement('cp:coreProperties');
- $objWriter->writeAttribute('xmlns:cp', 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties');
- $objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
- $objWriter->writeAttribute('xmlns:dcterms', 'http://purl.org/dc/terms/');
- $objWriter->writeAttribute('xmlns:dcmitype', 'http://purl.org/dc/dcmitype/');
- $objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
-
- // dc:creator
- $objWriter->writeElement('dc:creator', $pPHPExcel->getProperties()->getCreator());
-
- // cp:lastModifiedBy
- $objWriter->writeElement('cp:lastModifiedBy', $pPHPExcel->getProperties()->getLastModifiedBy());
-
- // dcterms:created
- $objWriter->startElement('dcterms:created');
- $objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
- $objWriter->writeRawData(date(DATE_W3C, $pPHPExcel->getProperties()->getCreated()));
- $objWriter->endElement();
-
- // dcterms:modified
- $objWriter->startElement('dcterms:modified');
- $objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
- $objWriter->writeRawData(date(DATE_W3C, $pPHPExcel->getProperties()->getModified()));
- $objWriter->endElement();
-
- // dc:title
- $objWriter->writeElement('dc:title', $pPHPExcel->getProperties()->getTitle());
-
- // dc:description
- $objWriter->writeElement('dc:description', $pPHPExcel->getProperties()->getDescription());
-
- // dc:subject
- $objWriter->writeElement('dc:subject', $pPHPExcel->getProperties()->getSubject());
-
- // cp:keywords
- $objWriter->writeElement('cp:keywords', $pPHPExcel->getProperties()->getKeywords());
-
- // cp:category
- $objWriter->writeElement('cp:category', $pPHPExcel->getProperties()->getCategory());
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write docProps/custom.xml to XML format
- *
- * @param PHPExcel $pPHPExcel
- * @return string XML Output
- * @throws Exception
- */
- public function writeDocPropsCustom(PHPExcel $pPHPExcel = null)
- {
- $customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
- if (empty($customPropertyList)) {
- return;
- }
-
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // cp:coreProperties
- $objWriter->startElement('Properties');
- $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/custom-properties');
- $objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
-
-
- foreach($customPropertyList as $key => $customProperty) {
- $propertyValue = $pPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
- $propertyType = $pPHPExcel->getProperties()->getCustomPropertyType($customProperty);
-
- $objWriter->startElement('property');
- $objWriter->writeAttribute('fmtid', '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}');
- $objWriter->writeAttribute('pid', $key+2);
- $objWriter->writeAttribute('name', $customProperty);
-
- switch($propertyType) {
- case 'i' :
- $objWriter->writeElement('vt:i4', $propertyValue);
- break;
- case 'f' :
- $objWriter->writeElement('vt:r8', $propertyValue);
- break;
- case 'b' :
- $objWriter->writeElement('vt:bool', ($propertyValue) ? 'true' : 'false');
- break;
- case 'd' :
- $objWriter->startElement('vt:filetime');
- $objWriter->writeRawData(date(DATE_W3C, $propertyValue));
- $objWriter->endElement();
- break;
- default :
- $objWriter->writeElement('vt:lpwstr', $propertyValue);
- break;
- }
-
- $objWriter->endElement();
- }
-
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
-}
diff --git a/admin/survey/excel/PHPExcel/Writer/Excel2007/Drawing.php b/admin/survey/excel/PHPExcel/Writer/Excel2007/Drawing.php deleted file mode 100644 index 60987f4..0000000 --- a/admin/survey/excel/PHPExcel/Writer/Excel2007/Drawing.php +++ /dev/null @@ -1,598 +0,0 @@ -<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2012 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
- * @version 1.7.8, 2012-10-12
- */
-
-
-/**
- * PHPExcel_Writer_Excel2007_Drawing
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_WriterPart
-{
- /**
- * Write drawings to XML format
- *
- * @param PHPExcel_Worksheet $pWorksheet
- * @param int &$chartRef Chart ID
- * @param boolean $includeCharts Flag indicating if we should include drawing details for charts
- * @return string XML Output
- * @throws Exception
- */
- public function writeDrawings(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // xdr:wsDr
- $objWriter->startElement('xdr:wsDr');
- $objWriter->writeAttribute('xmlns:xdr', 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing');
- $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
-
- // Loop through images and write drawings
- $i = 1;
- $iterator = $pWorksheet->getDrawingCollection()->getIterator();
- while ($iterator->valid()) {
- $this->_writeDrawing($objWriter, $iterator->current(), $i);
-
- $iterator->next();
- ++$i;
- }
-
- if ($includeCharts) {
- $chartCount = $pWorksheet->getChartCount();
- // Loop through charts and write the chart position
- if ($chartCount > 0) {
- for ($c = 0; $c < $chartCount; ++$c) {
- $this->_writeChart($objWriter, $pWorksheet->getChartByIndex($c), $c+$i);
- }
- }
- }
-
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write drawings to XML format
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Chart $pChart
- * @param int $pRelationId
- * @throws Exception
- */
- public function _writeChart(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Chart $pChart = null, $pRelationId = -1)
- {
- $tl = $pChart->getTopLeftPosition();
- $tl['colRow'] = PHPExcel_Cell::coordinateFromString($tl['cell']);
- $br = $pChart->getBottomRightPosition();
- $br['colRow'] = PHPExcel_Cell::coordinateFromString($br['cell']);
-
- $objWriter->startElement('xdr:twoCellAnchor');
-
- $objWriter->startElement('xdr:from');
- $objWriter->writeElement('xdr:col', PHPExcel_Cell::columnIndexFromString($tl['colRow'][0]) - 1);
- $objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($tl['xOffset']));
- $objWriter->writeElement('xdr:row', $tl['colRow'][1] - 1);
- $objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($tl['yOffset']));
- $objWriter->endElement();
- $objWriter->startElement('xdr:to');
- $objWriter->writeElement('xdr:col', PHPExcel_Cell::columnIndexFromString($br['colRow'][0]) - 1);
- $objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($br['xOffset']));
- $objWriter->writeElement('xdr:row', $br['colRow'][1] - 1);
- $objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($br['yOffset']));
- $objWriter->endElement();
-
- $objWriter->startElement('xdr:graphicFrame');
- $objWriter->writeAttribute('macro', '');
- $objWriter->startElement('xdr:nvGraphicFramePr');
- $objWriter->startElement('xdr:cNvPr');
- $objWriter->writeAttribute('name', 'Chart '.$pRelationId);
- $objWriter->writeAttribute('id', 1025 * $pRelationId);
- $objWriter->endElement();
- $objWriter->startElement('xdr:cNvGraphicFramePr');
- $objWriter->startElement('a:graphicFrameLocks');
- $objWriter->endElement();
- $objWriter->endElement();
- $objWriter->endElement();
-
- $objWriter->startElement('xdr:xfrm');
- $objWriter->startElement('a:off');
- $objWriter->writeAttribute('x', '0');
- $objWriter->writeAttribute('y', '0');
- $objWriter->endElement();
- $objWriter->startElement('a:ext');
- $objWriter->writeAttribute('cx', '0');
- $objWriter->writeAttribute('cy', '0');
- $objWriter->endElement();
- $objWriter->endElement();
-
- $objWriter->startElement('a:graphic');
- $objWriter->startElement('a:graphicData');
- $objWriter->writeAttribute('uri', 'http://schemas.openxmlformats.org/drawingml/2006/chart');
- $objWriter->startElement('c:chart');
- $objWriter->writeAttribute('xmlns:c', 'http://schemas.openxmlformats.org/drawingml/2006/chart');
- $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
- $objWriter->writeAttribute('r:id', 'rId'.$pRelationId);
- $objWriter->endElement();
- $objWriter->endElement();
- $objWriter->endElement();
- $objWriter->endElement();
-
- $objWriter->startElement('xdr:clientData');
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-
- /**
- * Write drawings to XML format
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet_BaseDrawing $pDrawing
- * @param int $pRelationId
- * @throws Exception
- */
- public function _writeDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet_BaseDrawing $pDrawing = null, $pRelationId = -1)
- {
- if ($pRelationId >= 0) {
- // xdr:oneCellAnchor
- $objWriter->startElement('xdr:oneCellAnchor');
- // Image location
- $aCoordinates = PHPExcel_Cell::coordinateFromString($pDrawing->getCoordinates());
- $aCoordinates[0] = PHPExcel_Cell::columnIndexFromString($aCoordinates[0]);
-
- // xdr:from
- $objWriter->startElement('xdr:from');
- $objWriter->writeElement('xdr:col', $aCoordinates[0] - 1);
- $objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetX()));
- $objWriter->writeElement('xdr:row', $aCoordinates[1] - 1);
- $objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetY()));
- $objWriter->endElement();
-
- // xdr:ext
- $objWriter->startElement('xdr:ext');
- $objWriter->writeAttribute('cx', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getWidth()));
- $objWriter->writeAttribute('cy', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getHeight()));
- $objWriter->endElement();
-
- // xdr:pic
- $objWriter->startElement('xdr:pic');
-
- // xdr:nvPicPr
- $objWriter->startElement('xdr:nvPicPr');
-
- // xdr:cNvPr
- $objWriter->startElement('xdr:cNvPr');
- $objWriter->writeAttribute('id', $pRelationId);
- $objWriter->writeAttribute('name', $pDrawing->getName());
- $objWriter->writeAttribute('descr', $pDrawing->getDescription());
- $objWriter->endElement();
-
- // xdr:cNvPicPr
- $objWriter->startElement('xdr:cNvPicPr');
-
- // a:picLocks
- $objWriter->startElement('a:picLocks');
- $objWriter->writeAttribute('noChangeAspect', '1');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // xdr:blipFill
- $objWriter->startElement('xdr:blipFill');
-
- // a:blip
- $objWriter->startElement('a:blip');
- $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
- $objWriter->writeAttribute('r:embed', 'rId' . $pRelationId);
- $objWriter->endElement();
-
- // a:stretch
- $objWriter->startElement('a:stretch');
- $objWriter->writeElement('a:fillRect', null);
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // xdr:spPr
- $objWriter->startElement('xdr:spPr');
-
- // a:xfrm
- $objWriter->startElement('a:xfrm');
- $objWriter->writeAttribute('rot', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getRotation()));
- $objWriter->endElement();
-
- // a:prstGeom
- $objWriter->startElement('a:prstGeom');
- $objWriter->writeAttribute('prst', 'rect');
-
- // a:avLst
- $objWriter->writeElement('a:avLst', null);
-
- $objWriter->endElement();
-
-// // a:solidFill
-// $objWriter->startElement('a:solidFill');
-
-// // a:srgbClr
-// $objWriter->startElement('a:srgbClr');
-// $objWriter->writeAttribute('val', 'FFFFFF');
-
-///* SHADE
-// // a:shade
-// $objWriter->startElement('a:shade');
-// $objWriter->writeAttribute('val', '85000');
-// $objWriter->endElement();
-//*/
-
-// $objWriter->endElement();
-
-// $objWriter->endElement();
-/*
- // a:ln
- $objWriter->startElement('a:ln');
- $objWriter->writeAttribute('w', '88900');
- $objWriter->writeAttribute('cap', 'sq');
-
- // a:solidFill
- $objWriter->startElement('a:solidFill');
-
- // a:srgbClr
- $objWriter->startElement('a:srgbClr');
- $objWriter->writeAttribute('val', 'FFFFFF');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:miter
- $objWriter->startElement('a:miter');
- $objWriter->writeAttribute('lim', '800000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-*/
-
- if ($pDrawing->getShadow()->getVisible()) {
- // a:effectLst
- $objWriter->startElement('a:effectLst');
-
- // a:outerShdw
- $objWriter->startElement('a:outerShdw');
- $objWriter->writeAttribute('blurRad', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getBlurRadius()));
- $objWriter->writeAttribute('dist', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getDistance()));
- $objWriter->writeAttribute('dir', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getShadow()->getDirection()));
- $objWriter->writeAttribute('algn', $pDrawing->getShadow()->getAlignment());
- $objWriter->writeAttribute('rotWithShape', '0');
-
- // a:srgbClr
- $objWriter->startElement('a:srgbClr');
- $objWriter->writeAttribute('val', $pDrawing->getShadow()->getColor()->getRGB());
-
- // a:alpha
- $objWriter->startElement('a:alpha');
- $objWriter->writeAttribute('val', $pDrawing->getShadow()->getAlpha() * 1000);
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-/*
-
- // a:scene3d
- $objWriter->startElement('a:scene3d');
-
- // a:camera
- $objWriter->startElement('a:camera');
- $objWriter->writeAttribute('prst', 'orthographicFront');
- $objWriter->endElement();
-
- // a:lightRig
- $objWriter->startElement('a:lightRig');
- $objWriter->writeAttribute('rig', 'twoPt');
- $objWriter->writeAttribute('dir', 't');
-
- // a:rot
- $objWriter->startElement('a:rot');
- $objWriter->writeAttribute('lat', '0');
- $objWriter->writeAttribute('lon', '0');
- $objWriter->writeAttribute('rev', '0');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-*/
-/*
- // a:sp3d
- $objWriter->startElement('a:sp3d');
-
- // a:bevelT
- $objWriter->startElement('a:bevelT');
- $objWriter->writeAttribute('w', '25400');
- $objWriter->writeAttribute('h', '19050');
- $objWriter->endElement();
-
- // a:contourClr
- $objWriter->startElement('a:contourClr');
-
- // a:srgbClr
- $objWriter->startElement('a:srgbClr');
- $objWriter->writeAttribute('val', 'FFFFFF');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-*/
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // xdr:clientData
- $objWriter->writeElement('xdr:clientData', null);
-
- $objWriter->endElement();
- } else {
- throw new Exception("Invalid parameters passed.");
- }
- }
-
- /**
- * Write VML header/footer images to XML format
- *
- * @param PHPExcel_Worksheet $pWorksheet
- * @return string XML Output
- * @throws Exception
- */
- public function writeVMLHeaderFooterImages(PHPExcel_Worksheet $pWorksheet = null)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // Header/footer images
- $images = $pWorksheet->getHeaderFooter()->getImages();
-
- // xml
- $objWriter->startElement('xml');
- $objWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml');
- $objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
- $objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel');
-
- // o:shapelayout
- $objWriter->startElement('o:shapelayout');
- $objWriter->writeAttribute('v:ext', 'edit');
-
- // o:idmap
- $objWriter->startElement('o:idmap');
- $objWriter->writeAttribute('v:ext', 'edit');
- $objWriter->writeAttribute('data', '1');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // v:shapetype
- $objWriter->startElement('v:shapetype');
- $objWriter->writeAttribute('id', '_x0000_t75');
- $objWriter->writeAttribute('coordsize', '21600,21600');
- $objWriter->writeAttribute('o:spt', '75');
- $objWriter->writeAttribute('o:preferrelative', 't');
- $objWriter->writeAttribute('path', 'm@4@5l@4@11@9@11@9@5xe');
- $objWriter->writeAttribute('filled', 'f');
- $objWriter->writeAttribute('stroked', 'f');
-
- // v:stroke
- $objWriter->startElement('v:stroke');
- $objWriter->writeAttribute('joinstyle', 'miter');
- $objWriter->endElement();
-
- // v:formulas
- $objWriter->startElement('v:formulas');
-
- // v:f
- $objWriter->startElement('v:f');
- $objWriter->writeAttribute('eqn', 'if lineDrawn pixelLineWidth 0');
- $objWriter->endElement();
-
- // v:f
- $objWriter->startElement('v:f');
- $objWriter->writeAttribute('eqn', 'sum @0 1 0');
- $objWriter->endElement();
-
- // v:f
- $objWriter->startElement('v:f');
- $objWriter->writeAttribute('eqn', 'sum 0 0 @1');
- $objWriter->endElement();
-
- // v:f
- $objWriter->startElement('v:f');
- $objWriter->writeAttribute('eqn', 'prod @2 1 2');
- $objWriter->endElement();
-
- // v:f
- $objWriter->startElement('v:f');
- $objWriter->writeAttribute('eqn', 'prod @3 21600 pixelWidth');
- $objWriter->endElement();
-
- // v:f
- $objWriter->startElement('v:f');
- $objWriter->writeAttribute('eqn', 'prod @3 21600 pixelHeight');
- $objWriter->endElement();
-
- // v:f
- $objWriter->startElement('v:f');
- $objWriter->writeAttribute('eqn', 'sum @0 0 1');
- $objWriter->endElement();
-
- // v:f
- $objWriter->startElement('v:f');
- $objWriter->writeAttribute('eqn', 'prod @6 1 2');
- $objWriter->endElement();
-
- // v:f
- $objWriter->startElement('v:f');
- $objWriter->writeAttribute('eqn', 'prod @7 21600 pixelWidth');
- $objWriter->endElement();
-
- // v:f
- $objWriter->startElement('v:f');
- $objWriter->writeAttribute('eqn', 'sum @8 21600 0');
- $objWriter->endElement();
-
- // v:f
- $objWriter->startElement('v:f');
- $objWriter->writeAttribute('eqn', 'prod @7 21600 pixelHeight');
- $objWriter->endElement();
-
- // v:f
- $objWriter->startElement('v:f');
- $objWriter->writeAttribute('eqn', 'sum @10 21600 0');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // v:path
- $objWriter->startElement('v:path');
- $objWriter->writeAttribute('o:extrusionok', 'f');
- $objWriter->writeAttribute('gradientshapeok', 't');
- $objWriter->writeAttribute('o:connecttype', 'rect');
- $objWriter->endElement();
-
- // o:lock
- $objWriter->startElement('o:lock');
- $objWriter->writeAttribute('v:ext', 'edit');
- $objWriter->writeAttribute('aspectratio', 't');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // Loop through images
- foreach ($images as $key => $value) {
- $this->_writeVMLHeaderFooterImage($objWriter, $key, $value);
- }
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write VML comment to XML format
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param string $pReference Reference
- * @param PHPExcel_Worksheet_HeaderFooterDrawing $pImage Image
- * @throws Exception
- */
- public function _writeVMLHeaderFooterImage(PHPExcel_Shared_XMLWriter $objWriter = null, $pReference = '', PHPExcel_Worksheet_HeaderFooterDrawing $pImage = null)
- {
- // Calculate object id
- preg_match('{(\d+)}', md5($pReference), $m);
- $id = 1500 + (substr($m[1], 0, 2) * 1);
-
- // Calculate offset
- $width = $pImage->getWidth();
- $height = $pImage->getHeight();
- $marginLeft = $pImage->getOffsetX();
- $marginTop = $pImage->getOffsetY();
-
- // v:shape
- $objWriter->startElement('v:shape');
- $objWriter->writeAttribute('id', $pReference);
- $objWriter->writeAttribute('o:spid', '_x0000_s' . $id);
- $objWriter->writeAttribute('type', '#_x0000_t75');
- $objWriter->writeAttribute('style', "position:absolute;margin-left:{$marginLeft}px;margin-top:{$marginTop}px;width:{$width}px;height:{$height}px;z-index:1");
-
- // v:imagedata
- $objWriter->startElement('v:imagedata');
- $objWriter->writeAttribute('o:relid', 'rId' . $pReference);
- $objWriter->writeAttribute('o:title', $pImage->getName());
- $objWriter->endElement();
-
- // o:lock
- $objWriter->startElement('o:lock');
- $objWriter->writeAttribute('v:ext', 'edit');
- $objWriter->writeAttribute('rotation', 't');
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-
-
- /**
- * Get an array of all drawings
- *
- * @param PHPExcel $pPHPExcel
- * @return PHPExcel_Worksheet_Drawing[] All drawings in PHPExcel
- * @throws Exception
- */
- public function allDrawings(PHPExcel $pPHPExcel = null)
- {
- // Get an array of all drawings
- $aDrawings = array();
-
- // Loop through PHPExcel
- $sheetCount = $pPHPExcel->getSheetCount();
- for ($i = 0; $i < $sheetCount; ++$i) {
- // Loop through images and add to array
- $iterator = $pPHPExcel->getSheet($i)->getDrawingCollection()->getIterator();
- while ($iterator->valid()) {
- $aDrawings[] = $iterator->current();
-
- $iterator->next();
- }
- }
-
- return $aDrawings;
- }
-}
diff --git a/admin/survey/excel/PHPExcel/Writer/Excel2007/Rels.php b/admin/survey/excel/PHPExcel/Writer/Excel2007/Rels.php deleted file mode 100644 index 6e2291d..0000000 --- a/admin/survey/excel/PHPExcel/Writer/Excel2007/Rels.php +++ /dev/null @@ -1,417 +0,0 @@ -<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2012 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
- * @version 1.7.8, 2012-10-12
- */
-
-
-/**
- * PHPExcel_Writer_Excel2007_Rels
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPart
-{
- /**
- * Write relationships to XML format
- *
- * @param PHPExcel $pPHPExcel
- * @return string XML Output
- * @throws Exception
- */
- public function writeRelationships(PHPExcel $pPHPExcel = null)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // Relationships
- $objWriter->startElement('Relationships');
- $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
-
- $customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
- if (!empty($customPropertyList)) {
- // Relationship docProps/app.xml
- $this->_writeRelationship(
- $objWriter,
- 4,
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties',
- 'docProps/custom.xml'
- );
-
- }
-
- // Relationship docProps/app.xml
- $this->_writeRelationship(
- $objWriter,
- 3,
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties',
- 'docProps/app.xml'
- );
-
- // Relationship docProps/core.xml
- $this->_writeRelationship(
- $objWriter,
- 2,
- 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties',
- 'docProps/core.xml'
- );
-
- // Relationship xl/workbook.xml
- $this->_writeRelationship(
- $objWriter,
- 1,
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument',
- 'xl/workbook.xml'
- );
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write workbook relationships to XML format
- *
- * @param PHPExcel $pPHPExcel
- * @return string XML Output
- * @throws Exception
- */
- public function writeWorkbookRelationships(PHPExcel $pPHPExcel = null)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // Relationships
- $objWriter->startElement('Relationships');
- $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
-
- // Relationship styles.xml
- $this->_writeRelationship(
- $objWriter,
- 1,
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles',
- 'styles.xml'
- );
-
- // Relationship theme/theme1.xml
- $this->_writeRelationship(
- $objWriter,
- 2,
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
- 'theme/theme1.xml'
- );
-
- // Relationship sharedStrings.xml
- $this->_writeRelationship(
- $objWriter,
- 3,
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings',
- 'sharedStrings.xml'
- );
-
- // Relationships with sheets
- $sheetCount = $pPHPExcel->getSheetCount();
- for ($i = 0; $i < $sheetCount; ++$i) {
- $this->_writeRelationship(
- $objWriter,
- ($i + 1 + 3),
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet',
- 'worksheets/sheet' . ($i + 1) . '.xml'
- );
- }
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write worksheet relationships to XML format
- *
- * Numbering is as follows:
- * rId1 - Drawings
- * rId_hyperlink_x - Hyperlinks
- *
- * @param PHPExcel_Worksheet $pWorksheet
- * @param int $pWorksheetId
- * @param boolean $includeCharts Flag indicating if we should write charts
- * @return string XML Output
- * @throws Exception
- */
- public function writeWorksheetRelationships(PHPExcel_Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = FALSE)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // Relationships
- $objWriter->startElement('Relationships');
- $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
-
- // Write drawing relationships?
- $d = 0;
- if ($includeCharts) {
- $charts = $pWorksheet->getChartCollection();
- } else {
- $charts = array();
- }
- if (($pWorksheet->getDrawingCollection()->count() > 0) ||
- (count($charts) > 0)) {
- $this->_writeRelationship(
- $objWriter,
- ++$d,
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing',
- '../drawings/drawing' . $pWorksheetId . '.xml'
- );
- }
-
- // Write chart relationships?
-// $chartCount = 0;
-// $charts = $pWorksheet->getChartCollection();
-// echo 'Chart Rels: ' , count($charts) , '<br />';
-// if (count($charts) > 0) {
-// foreach($charts as $chart) {
-// $this->_writeRelationship(
-// $objWriter,
-// ++$d,
-// 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart',
-// '../charts/chart' . ++$chartCount . '.xml'
-// );
-// }
-// }
-//
- // Write hyperlink relationships?
- $i = 1;
- foreach ($pWorksheet->getHyperlinkCollection() as $hyperlink) {
- if (!$hyperlink->isInternal()) {
- $this->_writeRelationship(
- $objWriter,
- '_hyperlink_' . $i,
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
- $hyperlink->getUrl(),
- 'External'
- );
-
- ++$i;
- }
- }
-
- // Write comments relationship?
- $i = 1;
- if (count($pWorksheet->getComments()) > 0) {
- $this->_writeRelationship(
- $objWriter,
- '_comments_vml' . $i,
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
- '../drawings/vmlDrawing' . $pWorksheetId . '.vml'
- );
-
- $this->_writeRelationship(
- $objWriter,
- '_comments' . $i,
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments',
- '../comments' . $pWorksheetId . '.xml'
- );
- }
-
- // Write header/footer relationship?
- $i = 1;
- if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) {
- $this->_writeRelationship(
- $objWriter,
- '_headerfooter_vml' . $i,
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
- '../drawings/vmlDrawingHF' . $pWorksheetId . '.vml'
- );
- }
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write drawing relationships to XML format
- *
- * @param PHPExcel_Worksheet $pWorksheet
- * @param int &$chartRef Chart ID
- * @param boolean $includeCharts Flag indicating if we should write charts
- * @return string XML Output
- * @throws Exception
- */
- public function writeDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // Relationships
- $objWriter->startElement('Relationships');
- $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
-
- // Loop through images and write relationships
- $i = 1;
- $iterator = $pWorksheet->getDrawingCollection()->getIterator();
- while ($iterator->valid()) {
- if ($iterator->current() instanceof PHPExcel_Worksheet_Drawing
- || $iterator->current() instanceof PHPExcel_Worksheet_MemoryDrawing) {
- // Write relationship for image drawing
- $this->_writeRelationship(
- $objWriter,
- $i,
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
- '../media/' . str_replace(' ', '', $iterator->current()->getIndexedFilename())
- );
- }
-
- $iterator->next();
- ++$i;
- }
-
- if ($includeCharts) {
- // Loop through charts and write relationships
- $chartCount = $pWorksheet->getChartCount();
- if ($chartCount > 0) {
- for ($c = 0; $c < $chartCount; ++$c) {
- $this->_writeRelationship(
- $objWriter,
- $i++,
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart',
- '../charts/chart' . ++$chartRef . '.xml'
- );
- }
- }
- }
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write header/footer drawing relationships to XML format
- *
- * @param PHPExcel_Worksheet $pWorksheet
- * @return string XML Output
- * @throws Exception
- */
- public function writeHeaderFooterDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // Relationships
- $objWriter->startElement('Relationships');
- $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
-
- // Loop through images and write relationships
- foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) {
- // Write relationship for image drawing
- $this->_writeRelationship(
- $objWriter,
- $key,
- 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
- '../media/' . $value->getIndexedFilename()
- );
- }
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write Override content type
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param int $pId Relationship ID. rId will be prepended!
- * @param string $pType Relationship type
- * @param string $pTarget Relationship target
- * @param string $pTargetMode Relationship target mode
- * @throws Exception
- */
- private function _writeRelationship(PHPExcel_Shared_XMLWriter $objWriter = null, $pId = 1, $pType = '', $pTarget = '', $pTargetMode = '')
- {
- if ($pType != '' && $pTarget != '') {
- // Write relationship
- $objWriter->startElement('Relationship');
- $objWriter->writeAttribute('Id', 'rId' . $pId);
- $objWriter->writeAttribute('Type', $pType);
- $objWriter->writeAttribute('Target', $pTarget);
-
- if ($pTargetMode != '') {
- $objWriter->writeAttribute('TargetMode', $pTargetMode);
- }
-
- $objWriter->endElement();
- } else {
- throw new Exception("Invalid parameters passed.");
- }
- }
-}
diff --git a/admin/survey/excel/PHPExcel/Writer/Excel2007/StringTable.php b/admin/survey/excel/PHPExcel/Writer/Excel2007/StringTable.php deleted file mode 100644 index a4c4e52..0000000 --- a/admin/survey/excel/PHPExcel/Writer/Excel2007/StringTable.php +++ /dev/null @@ -1,319 +0,0 @@ -<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2012 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
- * @version 1.7.8, 2012-10-12
- */
-
-
-/**
- * PHPExcel_Writer_Excel2007_StringTable
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_WriterPart
-{
- /**
- * Create worksheet stringtable
- *
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @param string[] $pExistingTable Existing table to eventually merge with
- * @return string[] String table for worksheet
- * @throws Exception
- */
- public function createStringTable($pSheet = null, $pExistingTable = null)
- {
- if ($pSheet !== NULL) {
- // Create string lookup table
- $aStringTable = array();
- $cellCollection = null;
- $aFlippedStringTable = null; // For faster lookup
-
- // Is an existing table given?
- if (($pExistingTable !== NULL) && is_array($pExistingTable)) {
- $aStringTable = $pExistingTable;
- }
-
- // Fill index array
- $aFlippedStringTable = $this->flipStringTable($aStringTable);
-
- // Loop through cells
- foreach ($pSheet->getCellCollection() as $cellID) {
- $cell = $pSheet->getCell($cellID);
- $cellValue = $cell->getValue();
- if (!is_object($cellValue) &&
- ($cellValue !== NULL) &&
- $cellValue !== '' &&
- !isset($aFlippedStringTable[$cellValue]) &&
- ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING2 || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_NULL)) {
- $aStringTable[] = $cellValue;
- $aFlippedStringTable[$cellValue] = true;
- } elseif ($cellValue instanceof PHPExcel_RichText &&
- ($cellValue !== NULL) &&
- !isset($aFlippedStringTable[$cellValue->getHashCode()])) {
- $aStringTable[] = $cellValue;
- $aFlippedStringTable[$cellValue->getHashCode()] = true;
- }
- }
-
- // Return
- return $aStringTable;
- } else {
- throw new Exception("Invalid PHPExcel_Worksheet object passed.");
- }
- }
-
- /**
- * Write string table to XML format
- *
- * @param string[] $pStringTable
- * @return string XML Output
- * @throws Exception
- */
- public function writeStringTable($pStringTable = null)
- {
- if ($pStringTable !== NULL) {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // String table
- $objWriter->startElement('sst');
- $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
- $objWriter->writeAttribute('uniqueCount', count($pStringTable));
-
- // Loop through string table
- foreach ($pStringTable as $textElement) {
- $objWriter->startElement('si');
-
- if (! $textElement instanceof PHPExcel_RichText) {
- $textToWrite = PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $textElement );
- $objWriter->startElement('t');
- if ($textToWrite !== trim($textToWrite)) {
- $objWriter->writeAttribute('xml:space', 'preserve');
- }
- $objWriter->writeRawData($textToWrite);
- $objWriter->endElement();
- } else if ($textElement instanceof PHPExcel_RichText) {
- $this->writeRichText($objWriter, $textElement);
- }
-
- $objWriter->endElement();
- }
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- } else {
- throw new Exception("Invalid string table array passed.");
- }
- }
-
- /**
- * Write Rich Text
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_RichText $pRichText Rich text
- * @param string $prefix Optional Namespace prefix
- * @throws Exception
- */
- public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null, $prefix=NULL)
- {
- if ($prefix !== NULL)
- $prefix .= ':';
- // Loop through rich text elements
- $elements = $pRichText->getRichTextElements();
- foreach ($elements as $element) {
- // r
- $objWriter->startElement($prefix.'r');
-
- // rPr
- if ($element instanceof PHPExcel_RichText_Run) {
- // rPr
- $objWriter->startElement($prefix.'rPr');
-
- // rFont
- $objWriter->startElement($prefix.'rFont');
- $objWriter->writeAttribute('val', $element->getFont()->getName());
- $objWriter->endElement();
-
- // Bold
- $objWriter->startElement($prefix.'b');
- $objWriter->writeAttribute('val', ($element->getFont()->getBold() ? 'true' : 'false'));
- $objWriter->endElement();
-
- // Italic
- $objWriter->startElement($prefix.'i');
- $objWriter->writeAttribute('val', ($element->getFont()->getItalic() ? 'true' : 'false'));
- $objWriter->endElement();
-
- // Superscript / subscript
- if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) {
- $objWriter->startElement($prefix.'vertAlign');
- if ($element->getFont()->getSuperScript()) {
- $objWriter->writeAttribute('val', 'superscript');
- } else if ($element->getFont()->getSubScript()) {
- $objWriter->writeAttribute('val', 'subscript');
- }
- $objWriter->endElement();
- }
-
- // Strikethrough
- $objWriter->startElement($prefix.'strike');
- $objWriter->writeAttribute('val', ($element->getFont()->getStrikethrough() ? 'true' : 'false'));
- $objWriter->endElement();
-
- // Color
- $objWriter->startElement($prefix.'color');
- $objWriter->writeAttribute('rgb', $element->getFont()->getColor()->getARGB());
- $objWriter->endElement();
-
- // Size
- $objWriter->startElement($prefix.'sz');
- $objWriter->writeAttribute('val', $element->getFont()->getSize());
- $objWriter->endElement();
-
- // Underline
- $objWriter->startElement($prefix.'u');
- $objWriter->writeAttribute('val', $element->getFont()->getUnderline());
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-
- // t
- $objWriter->startElement($prefix.'t');
- $objWriter->writeAttribute('xml:space', 'preserve');
- $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() ));
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
- }
-
- /**
- * Write Rich Text
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param string|PHPExcel_RichText $pRichText text string or Rich text
- * @param string $prefix Optional Namespace prefix
- * @throws Exception
- */
- public function writeRichTextForCharts(PHPExcel_Shared_XMLWriter $objWriter = null, $pRichText = null, $prefix=NULL)
- {
- if (!$pRichText instanceof PHPExcel_RichText) {
- $textRun = $pRichText;
- $pRichText = new PHPExcel_RichText();
- $pRichText->createTextRun($textRun);
- }
-
- if ($prefix !== NULL)
- $prefix .= ':';
- // Loop through rich text elements
- $elements = $pRichText->getRichTextElements();
- foreach ($elements as $element) {
- // r
- $objWriter->startElement($prefix.'r');
-
- // rPr
- $objWriter->startElement($prefix.'rPr');
-
- // Bold
- $objWriter->writeAttribute('b', ($element->getFont()->getBold() ? 1 : 0));
- // Italic
- $objWriter->writeAttribute('i', ($element->getFont()->getItalic() ? 1 : 0));
- // Underline
- $underlineType = $element->getFont()->getUnderline();
- switch($underlineType) {
- case 'single' :
- $underlineType = 'sng';
- break;
- case 'double' :
- $underlineType = 'dbl';
- break;
- }
- $objWriter->writeAttribute('u', $underlineType);
- // Strikethrough
- $objWriter->writeAttribute('strike', ($element->getFont()->getStrikethrough() ? 'sngStrike' : 'noStrike'));
-
- // rFont
- $objWriter->startElement($prefix.'latin');
- $objWriter->writeAttribute('typeface', $element->getFont()->getName());
- $objWriter->endElement();
-
- // Superscript / subscript
-// if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) {
-// $objWriter->startElement($prefix.'vertAlign');
-// if ($element->getFont()->getSuperScript()) {
-// $objWriter->writeAttribute('val', 'superscript');
-// } else if ($element->getFont()->getSubScript()) {
-// $objWriter->writeAttribute('val', 'subscript');
-// }
-// $objWriter->endElement();
-// }
-//
- $objWriter->endElement();
-
- // t
- $objWriter->startElement($prefix.'t');
-// $objWriter->writeAttribute('xml:space', 'preserve'); // Excel2010 accepts, Excel2007 complains
- $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() ));
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
- }
-
- /**
- * Flip string table (for index searching)
- *
- * @param array $stringTable Stringtable
- * @return array
- */
- public function flipStringTable($stringTable = array()) {
- // Return value
- $returnValue = array();
-
- // Loop through stringtable and add flipped items to $returnValue
- foreach ($stringTable as $key => $value) {
- if (! $value instanceof PHPExcel_RichText) {
- $returnValue[$value] = $key;
- } else if ($value instanceof PHPExcel_RichText) {
- $returnValue[$value->getHashCode()] = $key;
- }
- }
-
- // Return
- return $returnValue;
- }
-}
diff --git a/admin/survey/excel/PHPExcel/Writer/Excel2007/Style.php b/admin/survey/excel/PHPExcel/Writer/Excel2007/Style.php deleted file mode 100644 index 0a053f3..0000000 --- a/admin/survey/excel/PHPExcel/Writer/Excel2007/Style.php +++ /dev/null @@ -1,701 +0,0 @@ -<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2012 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
- * @version 1.7.8, 2012-10-12
- */
-
-
-/**
- * PHPExcel_Writer_Excel2007_Style
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPart
-{
- /**
- * Write styles to XML format
- *
- * @param PHPExcel $pPHPExcel
- * @return string XML Output
- * @throws Exception
- */
- public function writeStyles(PHPExcel $pPHPExcel = null)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // styleSheet
- $objWriter->startElement('styleSheet');
- $objWriter->writeAttribute('xml:space', 'preserve');
- $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
-
- // numFmts
- $objWriter->startElement('numFmts');
- $objWriter->writeAttribute('count', $this->getParentWriter()->getNumFmtHashTable()->count());
-
- // numFmt
- for ($i = 0; $i < $this->getParentWriter()->getNumFmtHashTable()->count(); ++$i) {
- $this->_writeNumFmt($objWriter, $this->getParentWriter()->getNumFmtHashTable()->getByIndex($i), $i);
- }
-
- $objWriter->endElement();
-
- // fonts
- $objWriter->startElement('fonts');
- $objWriter->writeAttribute('count', $this->getParentWriter()->getFontHashTable()->count());
-
- // font
- for ($i = 0; $i < $this->getParentWriter()->getFontHashTable()->count(); ++$i) {
- $this->_writeFont($objWriter, $this->getParentWriter()->getFontHashTable()->getByIndex($i));
- }
-
- $objWriter->endElement();
-
- // fills
- $objWriter->startElement('fills');
- $objWriter->writeAttribute('count', $this->getParentWriter()->getFillHashTable()->count());
-
- // fill
- for ($i = 0; $i < $this->getParentWriter()->getFillHashTable()->count(); ++$i) {
- $this->_writeFill($objWriter, $this->getParentWriter()->getFillHashTable()->getByIndex($i));
- }
-
- $objWriter->endElement();
-
- // borders
- $objWriter->startElement('borders');
- $objWriter->writeAttribute('count', $this->getParentWriter()->getBordersHashTable()->count());
-
- // border
- for ($i = 0; $i < $this->getParentWriter()->getBordersHashTable()->count(); ++$i) {
- $this->_writeBorder($objWriter, $this->getParentWriter()->getBordersHashTable()->getByIndex($i));
- }
-
- $objWriter->endElement();
-
- // cellStyleXfs
- $objWriter->startElement('cellStyleXfs');
- $objWriter->writeAttribute('count', 1);
-
- // xf
- $objWriter->startElement('xf');
- $objWriter->writeAttribute('numFmtId', 0);
- $objWriter->writeAttribute('fontId', 0);
- $objWriter->writeAttribute('fillId', 0);
- $objWriter->writeAttribute('borderId', 0);
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // cellXfs
- $objWriter->startElement('cellXfs');
- $objWriter->writeAttribute('count', count($pPHPExcel->getCellXfCollection()));
-
- // xf
- foreach ($pPHPExcel->getCellXfCollection() as $cellXf) {
- $this->_writeCellStyleXf($objWriter, $cellXf, $pPHPExcel);
- }
-
- $objWriter->endElement();
-
- // cellStyles
- $objWriter->startElement('cellStyles');
- $objWriter->writeAttribute('count', 1);
-
- // cellStyle
- $objWriter->startElement('cellStyle');
- $objWriter->writeAttribute('name', 'Normal');
- $objWriter->writeAttribute('xfId', 0);
- $objWriter->writeAttribute('builtinId', 0);
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // dxfs
- $objWriter->startElement('dxfs');
- $objWriter->writeAttribute('count', $this->getParentWriter()->getStylesConditionalHashTable()->count());
-
- // dxf
- for ($i = 0; $i < $this->getParentWriter()->getStylesConditionalHashTable()->count(); ++$i) {
- $this->_writeCellStyleDxf($objWriter, $this->getParentWriter()->getStylesConditionalHashTable()->getByIndex($i)->getStyle());
- }
-
- $objWriter->endElement();
-
- // tableStyles
- $objWriter->startElement('tableStyles');
- $objWriter->writeAttribute('defaultTableStyle', 'TableStyleMedium9');
- $objWriter->writeAttribute('defaultPivotStyle', 'PivotTableStyle1');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write Fill
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Style_Fill $pFill Fill style
- * @throws Exception
- */
- private function _writeFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null)
- {
- // Check if this is a pattern type or gradient type
- if ($pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR ||
- $pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_PATH) {
- // Gradient fill
- $this->_writeGradientFill($objWriter, $pFill);
- } elseif($pFill->getFillType() !== NULL) {
- // Pattern fill
- $this->_writePatternFill($objWriter, $pFill);
- }
- }
-
- /**
- * Write Gradient Fill
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Style_Fill $pFill Fill style
- * @throws Exception
- */
- private function _writeGradientFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null)
- {
- // fill
- $objWriter->startElement('fill');
-
- // gradientFill
- $objWriter->startElement('gradientFill');
- $objWriter->writeAttribute('type', $pFill->getFillType());
- $objWriter->writeAttribute('degree', $pFill->getRotation());
-
- // stop
- $objWriter->startElement('stop');
- $objWriter->writeAttribute('position', '0');
-
- // color
- $objWriter->startElement('color');
- $objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // stop
- $objWriter->startElement('stop');
- $objWriter->writeAttribute('position', '1');
-
- // color
- $objWriter->startElement('color');
- $objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-
- /**
- * Write Pattern Fill
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Style_Fill $pFill Fill style
- * @throws Exception
- */
- private function _writePatternFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null)
- {
- // fill
- $objWriter->startElement('fill');
-
- // patternFill
- $objWriter->startElement('patternFill');
- $objWriter->writeAttribute('patternType', $pFill->getFillType());
-
- if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
- // fgColor
- if ($pFill->getStartColor()->getARGB()) {
- $objWriter->startElement('fgColor');
- $objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
- $objWriter->endElement();
- }
- }
- if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
- // bgColor
- if ($pFill->getEndColor()->getARGB()) {
- $objWriter->startElement('bgColor');
- $objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
- $objWriter->endElement();
- }
- }
-
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-
- /**
- * Write Font
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Style_Font $pFont Font style
- * @throws Exception
- */
- private function _writeFont(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Font $pFont = null)
- {
- // font
- $objWriter->startElement('font');
- // Weird! The order of these elements actually makes a difference when opening Excel2007
- // files in Excel2003 with the compatibility pack. It's not documented behaviour,
- // and makes for a real WTF!
-
- // 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) {
- $objWriter->startElement('b');
- $objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
- $objWriter->endElement();
- }
-
- // Italic
- if ($pFont->getItalic() !== NULL) {
- $objWriter->startElement('i');
- $objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
- $objWriter->endElement();
- }
-
- // Strikethrough
- if ($pFont->getStrikethrough() !== NULL) {
- $objWriter->startElement('strike');
- $objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
- $objWriter->endElement();
- }
-
- // Underline
- if ($pFont->getUnderline() !== NULL) {
- $objWriter->startElement('u');
- $objWriter->writeAttribute('val', $pFont->getUnderline());
- $objWriter->endElement();
- }
-
- // Superscript / subscript
- if ($pFont->getSuperScript() === TRUE || $pFont->getSubScript() === TRUE) {
- $objWriter->startElement('vertAlign');
- if ($pFont->getSuperScript() === TRUE) {
- $objWriter->writeAttribute('val', 'superscript');
- } else if ($pFont->getSubScript() === TRUE) {
- $objWriter->writeAttribute('val', 'subscript');
- }
- $objWriter->endElement();
- }
-
- // Size
- if ($pFont->getSize() !== NULL) {
- $objWriter->startElement('sz');
- $objWriter->writeAttribute('val', $pFont->getSize());
- $objWriter->endElement();
- }
-
- // Foreground color
- if ($pFont->getColor()->getARGB() !== NULL) {
- $objWriter->startElement('color');
- $objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
- $objWriter->endElement();
- }
-
- // Name
- if ($pFont->getName() !== NULL) {
- $objWriter->startElement('name');
- $objWriter->writeAttribute('val', $pFont->getName());
- $objWriter->endElement();
- }
-
- $objWriter->endElement();
- }
-
- /**
- * Write Border
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Style_Borders $pBorders Borders style
- * @throws Exception
- */
- private function _writeBorder(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Borders $pBorders = null)
- {
- // Write border
- $objWriter->startElement('border');
- // Diagonal?
- switch ($pBorders->getDiagonalDirection()) {
- case PHPExcel_Style_Borders::DIAGONAL_UP:
- $objWriter->writeAttribute('diagonalUp', 'true');
- $objWriter->writeAttribute('diagonalDown', 'false');
- break;
- case PHPExcel_Style_Borders::DIAGONAL_DOWN:
- $objWriter->writeAttribute('diagonalUp', 'false');
- $objWriter->writeAttribute('diagonalDown', 'true');
- break;
- case PHPExcel_Style_Borders::DIAGONAL_BOTH:
- $objWriter->writeAttribute('diagonalUp', 'true');
- $objWriter->writeAttribute('diagonalDown', 'true');
- break;
- }
-
- // BorderPr
- $this->_writeBorderPr($objWriter, 'left', $pBorders->getLeft());
- $this->_writeBorderPr($objWriter, 'right', $pBorders->getRight());
- $this->_writeBorderPr($objWriter, 'top', $pBorders->getTop());
- $this->_writeBorderPr($objWriter, 'bottom', $pBorders->getBottom());
- $this->_writeBorderPr($objWriter, 'diagonal', $pBorders->getDiagonal());
- $objWriter->endElement();
- }
-
- /**
- * Write Cell Style Xf
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Style $pStyle Style
- * @param PHPExcel $pPHPExcel Workbook
- * @throws Exception
- */
- private function _writeCellStyleXf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null, PHPExcel $pPHPExcel = null)
- {
- // xf
- $objWriter->startElement('xf');
- $objWriter->writeAttribute('xfId', 0);
- $objWriter->writeAttribute('fontId', (int)$this->getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode()));
-
- if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) {
- $objWriter->writeAttribute('numFmtId', (int)($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164) );
- } else {
- $objWriter->writeAttribute('numFmtId', (int)$pStyle->getNumberFormat()->getBuiltInFormatCode());
- }
-
- $objWriter->writeAttribute('fillId', (int)$this->getParentWriter()->getFillHashTable()->getIndexForHashCode($pStyle->getFill()->getHashCode()));
- $objWriter->writeAttribute('borderId', (int)$this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($pStyle->getBorders()->getHashCode()));
-
- // Apply styles?
- $objWriter->writeAttribute('applyFont', ($pPHPExcel->getDefaultStyle()->getFont()->getHashCode() != $pStyle->getFont()->getHashCode()) ? '1' : '0');
- $objWriter->writeAttribute('applyNumberFormat', ($pPHPExcel->getDefaultStyle()->getNumberFormat()->getHashCode() != $pStyle->getNumberFormat()->getHashCode()) ? '1' : '0');
- $objWriter->writeAttribute('applyFill', ($pPHPExcel->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode()) ? '1' : '0');
- $objWriter->writeAttribute('applyBorder', ($pPHPExcel->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode()) ? '1' : '0');
- $objWriter->writeAttribute('applyAlignment', ($pPHPExcel->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode()) ? '1' : '0');
- if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
- $objWriter->writeAttribute('applyProtection', 'true');
- }
-
- // alignment
- $objWriter->startElement('alignment');
- $objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
- $objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
-
- $textRotation = 0;
- if ($pStyle->getAlignment()->getTextRotation() >= 0) {
- $textRotation = $pStyle->getAlignment()->getTextRotation();
- } else if ($pStyle->getAlignment()->getTextRotation() < 0) {
- $textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
- }
- $objWriter->writeAttribute('textRotation', $textRotation);
-
- $objWriter->writeAttribute('wrapText', ($pStyle->getAlignment()->getWrapText() ? 'true' : 'false'));
- $objWriter->writeAttribute('shrinkToFit', ($pStyle->getAlignment()->getShrinkToFit() ? 'true' : 'false'));
-
- if ($pStyle->getAlignment()->getIndent() > 0) {
- $objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent());
- }
- $objWriter->endElement();
-
- // protection
- if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
- $objWriter->startElement('protection');
- if ($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() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
- $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
- }
- $objWriter->endElement();
- }
-
- $objWriter->endElement();
- }
-
- /**
- * Write Cell Style Dxf
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Style $pStyle Style
- * @throws Exception
- */
- private function _writeCellStyleDxf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null)
- {
- // dxf
- $objWriter->startElement('dxf');
-
- // font
- $this->_writeFont($objWriter, $pStyle->getFont());
-
- // numFmt
- $this->_writeNumFmt($objWriter, $pStyle->getNumberFormat());
-
- // fill
- $this->_writeFill($objWriter, $pStyle->getFill());
-
- // alignment
- $objWriter->startElement('alignment');
- if ($pStyle->getAlignment()->getHorizontal() !== NULL) {
- $objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
- }
- if ($pStyle->getAlignment()->getVertical() !== NULL) {
- $objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
- }
-
- if ($pStyle->getAlignment()->getTextRotation() !== NULL) {
- $textRotation = 0;
- if ($pStyle->getAlignment()->getTextRotation() >= 0) {
- $textRotation = $pStyle->getAlignment()->getTextRotation();
- } else if ($pStyle->getAlignment()->getTextRotation() < 0) {
- $textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
- }
- $objWriter->writeAttribute('textRotation', $textRotation);
- }
- $objWriter->endElement();
-
- // border
- $this->_writeBorder($objWriter, $pStyle->getBorders());
-
- // protection
- 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) &&
- ($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) &&
- ($pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
- $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
- }
- $objWriter->endElement();
- }
- }
-
- $objWriter->endElement();
- }
-
- /**
- * Write BorderPr
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param string $pName Element name
- * @param PHPExcel_Style_Border $pBorder Border style
- * @throws Exception
- */
- private function _writeBorderPr(PHPExcel_Shared_XMLWriter $objWriter = null, $pName = 'left', PHPExcel_Style_Border $pBorder = null)
- {
- // Write BorderPr
- if ($pBorder->getBorderStyle() != PHPExcel_Style_Border::BORDER_NONE) {
- $objWriter->startElement($pName);
- $objWriter->writeAttribute('style', $pBorder->getBorderStyle());
-
- // color
- $objWriter->startElement('color');
- $objWriter->writeAttribute('rgb', $pBorder->getColor()->getARGB());
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
- }
-
- /**
- * Write NumberFormat
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Style_NumberFormat $pNumberFormat Number Format
- * @param int $pId Number Format identifier
- * @throws Exception
- */
- private function _writeNumFmt(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_NumberFormat $pNumberFormat = null, $pId = 0)
- {
- // Translate formatcode
- $formatCode = $pNumberFormat->getFormatCode();
-
- // numFmt
- if ($formatCode !== NULL) {
- $objWriter->startElement('numFmt');
- $objWriter->writeAttribute('numFmtId', ($pId + 164));
- $objWriter->writeAttribute('formatCode', $formatCode);
- $objWriter->endElement();
- }
- }
-
- /**
- * Get an array of all styles
- *
- * @param PHPExcel $pPHPExcel
- * @return PHPExcel_Style[] All styles in PHPExcel
- * @throws Exception
- */
- public function allStyles(PHPExcel $pPHPExcel = null)
- {
- $aStyles = $pPHPExcel->getCellXfCollection();
-
- return $aStyles;
- }
-
- /**
- * Get an array of all conditional styles
- *
- * @param PHPExcel $pPHPExcel
- * @return PHPExcel_Style_Conditional[] All conditional styles in PHPExcel
- * @throws Exception
- */
- public function allConditionalStyles(PHPExcel $pPHPExcel = null)
- {
- // Get an array of all styles
- $aStyles = array();
-
- $sheetCount = $pPHPExcel->getSheetCount();
- for ($i = 0; $i < $sheetCount; ++$i) {
- foreach ($pPHPExcel->getSheet($i)->getConditionalStylesCollection() as $conditionalStyles) {
- foreach ($conditionalStyles as $conditionalStyle) {
- $aStyles[] = $conditionalStyle;
- }
- }
- }
-
- return $aStyles;
- }
-
- /**
- * Get an array of all fills
- *
- * @param PHPExcel $pPHPExcel
- * @return PHPExcel_Style_Fill[] All fills in PHPExcel
- * @throws Exception
- */
- public function allFills(PHPExcel $pPHPExcel = null)
- {
- // Get an array of unique fills
- $aFills = array();
-
- // Two first fills are predefined
- $fill0 = new PHPExcel_Style_Fill();
- $fill0->setFillType(PHPExcel_Style_Fill::FILL_NONE);
- $aFills[] = $fill0;
-
- $fill1 = new PHPExcel_Style_Fill();
- $fill1->setFillType(PHPExcel_Style_Fill::FILL_PATTERN_GRAY125);
- $aFills[] = $fill1;
- // The remaining fills
- $aStyles = $this->allStyles($pPHPExcel);
- foreach ($aStyles as $style) {
- if (!array_key_exists($style->getFill()->getHashCode(), $aFills)) {
- $aFills[ $style->getFill()->getHashCode() ] = $style->getFill();
- }
- }
-
- return $aFills;
- }
-
- /**
- * Get an array of all fonts
- *
- * @param PHPExcel $pPHPExcel
- * @return PHPExcel_Style_Font[] All fonts in PHPExcel
- * @throws Exception
- */
- public function allFonts(PHPExcel $pPHPExcel = null)
- {
- // Get an array of unique fonts
- $aFonts = array();
- $aStyles = $this->allStyles($pPHPExcel);
-
- foreach ($aStyles as $style) {
- if (!array_key_exists($style->getFont()->getHashCode(), $aFonts)) {
- $aFonts[ $style->getFont()->getHashCode() ] = $style->getFont();
- }
- }
-
- return $aFonts;
- }
-
- /**
- * Get an array of all borders
- *
- * @param PHPExcel $pPHPExcel
- * @return PHPExcel_Style_Borders[] All borders in PHPExcel
- * @throws Exception
- */
- public function allBorders(PHPExcel $pPHPExcel = null)
- {
- // Get an array of unique borders
- $aBorders = array();
- $aStyles = $this->allStyles($pPHPExcel);
-
- foreach ($aStyles as $style) {
- if (!array_key_exists($style->getBorders()->getHashCode(), $aBorders)) {
- $aBorders[ $style->getBorders()->getHashCode() ] = $style->getBorders();
- }
- }
-
- return $aBorders;
- }
-
- /**
- * Get an array of all number formats
- *
- * @param PHPExcel $pPHPExcel
- * @return PHPExcel_Style_NumberFormat[] All number formats in PHPExcel
- * @throws Exception
- */
- public function allNumberFormats(PHPExcel $pPHPExcel = null)
- {
- // Get an array of unique number formats
- $aNumFmts = array();
- $aStyles = $this->allStyles($pPHPExcel);
-
- foreach ($aStyles as $style) {
- if ($style->getNumberFormat()->getBuiltInFormatCode() === false && !array_key_exists($style->getNumberFormat()->getHashCode(), $aNumFmts)) {
- $aNumFmts[ $style->getNumberFormat()->getHashCode() ] = $style->getNumberFormat();
- }
- }
-
- return $aNumFmts;
- }
-}
diff --git a/admin/survey/excel/PHPExcel/Writer/Excel2007/Theme.php b/admin/survey/excel/PHPExcel/Writer/Excel2007/Theme.php deleted file mode 100644 index dcb6cfb..0000000 --- a/admin/survey/excel/PHPExcel/Writer/Excel2007/Theme.php +++ /dev/null @@ -1,871 +0,0 @@ -<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2012 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
- * @version 1.7.8, 2012-10-12
- */
-
-
-/**
- * PHPExcel_Writer_Excel2007_DocProps
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPart
-{
- /**
- * Map of Major fonts to write
- * @static array of string
- *
- */
- private static $_majorFonts = array(
- 'Jpan' => 'MS Pゴシック',
- 'Hang' => '맑은 고딕',
- 'Hans' => '宋体',
- 'Hant' => '新細明體',
- 'Arab' => 'Times New Roman',
- 'Hebr' => 'Times New Roman',
- 'Thai' => 'Tahoma',
- 'Ethi' => 'Nyala',
- 'Beng' => 'Vrinda',
- 'Gujr' => 'Shruti',
- 'Khmr' => 'MoolBoran',
- 'Knda' => 'Tunga',
- 'Guru' => 'Raavi',
- 'Cans' => 'Euphemia',
- 'Cher' => 'Plantagenet Cherokee',
- 'Yiii' => 'Microsoft Yi Baiti',
- 'Tibt' => 'Microsoft Himalaya',
- 'Thaa' => 'MV Boli',
- 'Deva' => 'Mangal',
- 'Telu' => 'Gautami',
- 'Taml' => 'Latha',
- 'Syrc' => 'Estrangelo Edessa',
- 'Orya' => 'Kalinga',
- 'Mlym' => 'Kartika',
- 'Laoo' => 'DokChampa',
- 'Sinh' => 'Iskoola Pota',
- 'Mong' => 'Mongolian Baiti',
- 'Viet' => 'Times New Roman',
- 'Uigh' => 'Microsoft Uighur',
- 'Geor' => 'Sylfaen',
- );
-
- /**
- * Map of Minor fonts to write
- * @static array of string
- *
- */
- private static $_minorFonts = array(
- 'Jpan' => 'MS Pゴシック',
- 'Hang' => '맑은 고딕',
- 'Hans' => '宋体',
- 'Hant' => '新細明體',
- 'Arab' => 'Arial',
- 'Hebr' => 'Arial',
- 'Thai' => 'Tahoma',
- 'Ethi' => 'Nyala',
- 'Beng' => 'Vrinda',
- 'Gujr' => 'Shruti',
- 'Khmr' => 'DaunPenh',
- 'Knda' => 'Tunga',
- 'Guru' => 'Raavi',
- 'Cans' => 'Euphemia',
- 'Cher' => 'Plantagenet Cherokee',
- 'Yiii' => 'Microsoft Yi Baiti',
- 'Tibt' => 'Microsoft Himalaya',
- 'Thaa' => 'MV Boli',
- 'Deva' => 'Mangal',
- 'Telu' => 'Gautami',
- 'Taml' => 'Latha',
- 'Syrc' => 'Estrangelo Edessa',
- 'Orya' => 'Kalinga',
- 'Mlym' => 'Kartika',
- 'Laoo' => 'DokChampa',
- 'Sinh' => 'Iskoola Pota',
- 'Mong' => 'Mongolian Baiti',
- 'Viet' => 'Arial',
- 'Uigh' => 'Microsoft Uighur',
- 'Geor' => 'Sylfaen',
- );
-
- /**
- * Map of core colours
- * @static array of string
- *
- */
- private static $_colourScheme = array(
- 'dk2' => '1F497D',
- 'lt2' => 'EEECE1',
- 'accent1' => '4F81BD',
- 'accent2' => 'C0504D',
- 'accent3' => '9BBB59',
- 'accent4' => '8064A2',
- 'accent5' => '4BACC6',
- 'accent6' => 'F79646',
- 'hlink' => '0000FF',
- 'folHlink' => '800080',
- );
-
- /**
- * Write theme to XML format
- *
- * @param PHPExcel $pPHPExcel
- * @return string XML Output
- * @throws Exception
- */
- public function writeTheme(PHPExcel $pPHPExcel = null)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // a:theme
- $objWriter->startElement('a:theme');
- $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
- $objWriter->writeAttribute('name', 'Office Theme');
-
- // a:themeElements
- $objWriter->startElement('a:themeElements');
-
- // a:clrScheme
- $objWriter->startElement('a:clrScheme');
- $objWriter->writeAttribute('name', 'Office');
-
- // a:dk1
- $objWriter->startElement('a:dk1');
-
- // a:sysClr
- $objWriter->startElement('a:sysClr');
- $objWriter->writeAttribute('val', 'windowText');
- $objWriter->writeAttribute('lastClr', '000000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:lt1
- $objWriter->startElement('a:lt1');
-
- // a:sysClr
- $objWriter->startElement('a:sysClr');
- $objWriter->writeAttribute('val', 'window');
- $objWriter->writeAttribute('lastClr', 'FFFFFF');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:dk2
- $this->_writeColourScheme($objWriter);
-
- $objWriter->endElement();
-
- // a:fontScheme
- $objWriter->startElement('a:fontScheme');
- $objWriter->writeAttribute('name', 'Office');
-
- // a:majorFont
- $objWriter->startElement('a:majorFont');
- $this->_writeFonts($objWriter, 'Cambria', self::$_majorFonts);
- $objWriter->endElement();
-
- // a:minorFont
- $objWriter->startElement('a:minorFont');
- $this->_writeFonts($objWriter, 'Calibri', self::$_minorFonts);
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:fmtScheme
- $objWriter->startElement('a:fmtScheme');
- $objWriter->writeAttribute('name', 'Office');
-
- // a:fillStyleLst
- $objWriter->startElement('a:fillStyleLst');
-
- // a:solidFill
- $objWriter->startElement('a:solidFill');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:gradFill
- $objWriter->startElement('a:gradFill');
- $objWriter->writeAttribute('rotWithShape', '1');
-
- // a:gsLst
- $objWriter->startElement('a:gsLst');
-
- // a:gs
- $objWriter->startElement('a:gs');
- $objWriter->writeAttribute('pos', '0');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
-
- // a:tint
- $objWriter->startElement('a:tint');
- $objWriter->writeAttribute('val', '50000');
- $objWriter->endElement();
-
- // a:satMod
- $objWriter->startElement('a:satMod');
- $objWriter->writeAttribute('val', '300000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:gs
- $objWriter->startElement('a:gs');
- $objWriter->writeAttribute('pos', '35000');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
-
- // a:tint
- $objWriter->startElement('a:tint');
- $objWriter->writeAttribute('val', '37000');
- $objWriter->endElement();
-
- // a:satMod
- $objWriter->startElement('a:satMod');
- $objWriter->writeAttribute('val', '300000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:gs
- $objWriter->startElement('a:gs');
- $objWriter->writeAttribute('pos', '100000');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
-
- // a:tint
- $objWriter->startElement('a:tint');
- $objWriter->writeAttribute('val', '15000');
- $objWriter->endElement();
-
- // a:satMod
- $objWriter->startElement('a:satMod');
- $objWriter->writeAttribute('val', '350000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:lin
- $objWriter->startElement('a:lin');
- $objWriter->writeAttribute('ang', '16200000');
- $objWriter->writeAttribute('scaled', '1');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:gradFill
- $objWriter->startElement('a:gradFill');
- $objWriter->writeAttribute('rotWithShape', '1');
-
- // a:gsLst
- $objWriter->startElement('a:gsLst');
-
- // a:gs
- $objWriter->startElement('a:gs');
- $objWriter->writeAttribute('pos', '0');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
-
- // a:shade
- $objWriter->startElement('a:shade');
- $objWriter->writeAttribute('val', '51000');
- $objWriter->endElement();
-
- // a:satMod
- $objWriter->startElement('a:satMod');
- $objWriter->writeAttribute('val', '130000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:gs
- $objWriter->startElement('a:gs');
- $objWriter->writeAttribute('pos', '80000');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
-
- // a:shade
- $objWriter->startElement('a:shade');
- $objWriter->writeAttribute('val', '93000');
- $objWriter->endElement();
-
- // a:satMod
- $objWriter->startElement('a:satMod');
- $objWriter->writeAttribute('val', '130000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:gs
- $objWriter->startElement('a:gs');
- $objWriter->writeAttribute('pos', '100000');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
-
- // a:shade
- $objWriter->startElement('a:shade');
- $objWriter->writeAttribute('val', '94000');
- $objWriter->endElement();
-
- // a:satMod
- $objWriter->startElement('a:satMod');
- $objWriter->writeAttribute('val', '135000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:lin
- $objWriter->startElement('a:lin');
- $objWriter->writeAttribute('ang', '16200000');
- $objWriter->writeAttribute('scaled', '0');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:lnStyleLst
- $objWriter->startElement('a:lnStyleLst');
-
- // a:ln
- $objWriter->startElement('a:ln');
- $objWriter->writeAttribute('w', '9525');
- $objWriter->writeAttribute('cap', 'flat');
- $objWriter->writeAttribute('cmpd', 'sng');
- $objWriter->writeAttribute('algn', 'ctr');
-
- // a:solidFill
- $objWriter->startElement('a:solidFill');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
-
- // a:shade
- $objWriter->startElement('a:shade');
- $objWriter->writeAttribute('val', '95000');
- $objWriter->endElement();
-
- // a:satMod
- $objWriter->startElement('a:satMod');
- $objWriter->writeAttribute('val', '105000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:prstDash
- $objWriter->startElement('a:prstDash');
- $objWriter->writeAttribute('val', 'solid');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:ln
- $objWriter->startElement('a:ln');
- $objWriter->writeAttribute('w', '25400');
- $objWriter->writeAttribute('cap', 'flat');
- $objWriter->writeAttribute('cmpd', 'sng');
- $objWriter->writeAttribute('algn', 'ctr');
-
- // a:solidFill
- $objWriter->startElement('a:solidFill');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:prstDash
- $objWriter->startElement('a:prstDash');
- $objWriter->writeAttribute('val', 'solid');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:ln
- $objWriter->startElement('a:ln');
- $objWriter->writeAttribute('w', '38100');
- $objWriter->writeAttribute('cap', 'flat');
- $objWriter->writeAttribute('cmpd', 'sng');
- $objWriter->writeAttribute('algn', 'ctr');
-
- // a:solidFill
- $objWriter->startElement('a:solidFill');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:prstDash
- $objWriter->startElement('a:prstDash');
- $objWriter->writeAttribute('val', 'solid');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
-
-
- // a:effectStyleLst
- $objWriter->startElement('a:effectStyleLst');
-
- // a:effectStyle
- $objWriter->startElement('a:effectStyle');
-
- // a:effectLst
- $objWriter->startElement('a:effectLst');
-
- // a:outerShdw
- $objWriter->startElement('a:outerShdw');
- $objWriter->writeAttribute('blurRad', '40000');
- $objWriter->writeAttribute('dist', '20000');
- $objWriter->writeAttribute('dir', '5400000');
- $objWriter->writeAttribute('rotWithShape', '0');
-
- // a:srgbClr
- $objWriter->startElement('a:srgbClr');
- $objWriter->writeAttribute('val', '000000');
-
- // a:alpha
- $objWriter->startElement('a:alpha');
- $objWriter->writeAttribute('val', '38000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:effectStyle
- $objWriter->startElement('a:effectStyle');
-
- // a:effectLst
- $objWriter->startElement('a:effectLst');
-
- // a:outerShdw
- $objWriter->startElement('a:outerShdw');
- $objWriter->writeAttribute('blurRad', '40000');
- $objWriter->writeAttribute('dist', '23000');
- $objWriter->writeAttribute('dir', '5400000');
- $objWriter->writeAttribute('rotWithShape', '0');
-
- // a:srgbClr
- $objWriter->startElement('a:srgbClr');
- $objWriter->writeAttribute('val', '000000');
-
- // a:alpha
- $objWriter->startElement('a:alpha');
- $objWriter->writeAttribute('val', '35000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:effectStyle
- $objWriter->startElement('a:effectStyle');
-
- // a:effectLst
- $objWriter->startElement('a:effectLst');
-
- // a:outerShdw
- $objWriter->startElement('a:outerShdw');
- $objWriter->writeAttribute('blurRad', '40000');
- $objWriter->writeAttribute('dist', '23000');
- $objWriter->writeAttribute('dir', '5400000');
- $objWriter->writeAttribute('rotWithShape', '0');
-
- // a:srgbClr
- $objWriter->startElement('a:srgbClr');
- $objWriter->writeAttribute('val', '000000');
-
- // a:alpha
- $objWriter->startElement('a:alpha');
- $objWriter->writeAttribute('val', '35000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:scene3d
- $objWriter->startElement('a:scene3d');
-
- // a:camera
- $objWriter->startElement('a:camera');
- $objWriter->writeAttribute('prst', 'orthographicFront');
-
- // a:rot
- $objWriter->startElement('a:rot');
- $objWriter->writeAttribute('lat', '0');
- $objWriter->writeAttribute('lon', '0');
- $objWriter->writeAttribute('rev', '0');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:lightRig
- $objWriter->startElement('a:lightRig');
- $objWriter->writeAttribute('rig', 'threePt');
- $objWriter->writeAttribute('dir', 't');
-
- // a:rot
- $objWriter->startElement('a:rot');
- $objWriter->writeAttribute('lat', '0');
- $objWriter->writeAttribute('lon', '0');
- $objWriter->writeAttribute('rev', '1200000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:sp3d
- $objWriter->startElement('a:sp3d');
-
- // a:bevelT
- $objWriter->startElement('a:bevelT');
- $objWriter->writeAttribute('w', '63500');
- $objWriter->writeAttribute('h', '25400');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:bgFillStyleLst
- $objWriter->startElement('a:bgFillStyleLst');
-
- // a:solidFill
- $objWriter->startElement('a:solidFill');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:gradFill
- $objWriter->startElement('a:gradFill');
- $objWriter->writeAttribute('rotWithShape', '1');
-
- // a:gsLst
- $objWriter->startElement('a:gsLst');
-
- // a:gs
- $objWriter->startElement('a:gs');
- $objWriter->writeAttribute('pos', '0');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
-
- // a:tint
- $objWriter->startElement('a:tint');
- $objWriter->writeAttribute('val', '40000');
- $objWriter->endElement();
-
- // a:satMod
- $objWriter->startElement('a:satMod');
- $objWriter->writeAttribute('val', '350000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:gs
- $objWriter->startElement('a:gs');
- $objWriter->writeAttribute('pos', '40000');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
-
- // a:tint
- $objWriter->startElement('a:tint');
- $objWriter->writeAttribute('val', '45000');
- $objWriter->endElement();
-
- // a:shade
- $objWriter->startElement('a:shade');
- $objWriter->writeAttribute('val', '99000');
- $objWriter->endElement();
-
- // a:satMod
- $objWriter->startElement('a:satMod');
- $objWriter->writeAttribute('val', '350000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:gs
- $objWriter->startElement('a:gs');
- $objWriter->writeAttribute('pos', '100000');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
-
- // a:shade
- $objWriter->startElement('a:shade');
- $objWriter->writeAttribute('val', '20000');
- $objWriter->endElement();
-
- // a:satMod
- $objWriter->startElement('a:satMod');
- $objWriter->writeAttribute('val', '255000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:path
- $objWriter->startElement('a:path');
- $objWriter->writeAttribute('path', 'circle');
-
- // a:fillToRect
- $objWriter->startElement('a:fillToRect');
- $objWriter->writeAttribute('l', '50000');
- $objWriter->writeAttribute('t', '-80000');
- $objWriter->writeAttribute('r', '50000');
- $objWriter->writeAttribute('b', '180000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:gradFill
- $objWriter->startElement('a:gradFill');
- $objWriter->writeAttribute('rotWithShape', '1');
-
- // a:gsLst
- $objWriter->startElement('a:gsLst');
-
- // a:gs
- $objWriter->startElement('a:gs');
- $objWriter->writeAttribute('pos', '0');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
-
- // a:tint
- $objWriter->startElement('a:tint');
- $objWriter->writeAttribute('val', '80000');
- $objWriter->endElement();
-
- // a:satMod
- $objWriter->startElement('a:satMod');
- $objWriter->writeAttribute('val', '300000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:gs
- $objWriter->startElement('a:gs');
- $objWriter->writeAttribute('pos', '100000');
-
- // a:schemeClr
- $objWriter->startElement('a:schemeClr');
- $objWriter->writeAttribute('val', 'phClr');
-
- // a:shade
- $objWriter->startElement('a:shade');
- $objWriter->writeAttribute('val', '30000');
- $objWriter->endElement();
-
- // a:satMod
- $objWriter->startElement('a:satMod');
- $objWriter->writeAttribute('val', '200000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:path
- $objWriter->startElement('a:path');
- $objWriter->writeAttribute('path', 'circle');
-
- // a:fillToRect
- $objWriter->startElement('a:fillToRect');
- $objWriter->writeAttribute('l', '50000');
- $objWriter->writeAttribute('t', '50000');
- $objWriter->writeAttribute('r', '50000');
- $objWriter->writeAttribute('b', '50000');
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- $objWriter->endElement();
-
- // a:objectDefaults
- $objWriter->writeElement('a:objectDefaults', null);
-
- // a:extraClrSchemeLst
- $objWriter->writeElement('a:extraClrSchemeLst', null);
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write fonts to XML format
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter
- * @param string $latinFont
- * @param array of string $fontSet
- * @return string XML Output
- * @throws Exception
- */
- private function _writeFonts($objWriter, $latinFont, $fontSet)
- {
- // a:latin
- $objWriter->startElement('a:latin');
- $objWriter->writeAttribute('typeface', $latinFont);
- $objWriter->endElement();
-
- // a:ea
- $objWriter->startElement('a:ea');
- $objWriter->writeAttribute('typeface', '');
- $objWriter->endElement();
-
- // a:cs
- $objWriter->startElement('a:cs');
- $objWriter->writeAttribute('typeface', '');
- $objWriter->endElement();
-
- foreach($fontSet as $fontScript => $typeface) {
- $objWriter->startElement('a:font');
- $objWriter->writeAttribute('script', $fontScript);
- $objWriter->writeAttribute('typeface', $typeface);
- $objWriter->endElement();
- }
-
- }
-
- /**
- * Write colour scheme to XML format
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter
- * @return string XML Output
- * @throws Exception
- */
- private function _writeColourScheme($objWriter)
- {
- foreach(self::$_colourScheme as $colourName => $colourValue) {
- $objWriter->startElement('a:'.$colourName);
-
- $objWriter->startElement('a:srgbClr');
- $objWriter->writeAttribute('val', $colourValue);
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-
- }
-}
diff --git a/admin/survey/excel/PHPExcel/Writer/Excel2007/Workbook.php b/admin/survey/excel/PHPExcel/Writer/Excel2007/Workbook.php deleted file mode 100644 index 45b853b..0000000 --- a/admin/survey/excel/PHPExcel/Writer/Excel2007/Workbook.php +++ /dev/null @@ -1,452 +0,0 @@ -<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2012 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
- * @version 1.7.8, 2012-10-12
- */
-
-
-/**
- * PHPExcel_Writer_Excel2007_Workbook
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_WriterPart
-{
- /**
- * Write workbook to XML format
- *
- * @param PHPExcel $pPHPExcel
- * @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing
- * @return string XML Output
- * @throws Exception
- */
- public function writeWorkbook(PHPExcel $pPHPExcel = null, $recalcRequired = FALSE)
- {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // workbook
- $objWriter->startElement('workbook');
- $objWriter->writeAttribute('xml:space', 'preserve');
- $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
- $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
-
- // fileVersion
- $this->_writeFileVersion($objWriter);
-
- // workbookPr
- $this->_writeWorkbookPr($objWriter);
-
- // workbookProtection
- $this->_writeWorkbookProtection($objWriter, $pPHPExcel);
-
- // bookViews
- if ($this->getParentWriter()->getOffice2003Compatibility() === false) {
- $this->_writeBookViews($objWriter, $pPHPExcel);
- }
-
- // sheets
- $this->_writeSheets($objWriter, $pPHPExcel);
-
- // definedNames
- $this->_writeDefinedNames($objWriter, $pPHPExcel);
-
- // calcPr
- $this->_writeCalcPr($objWriter,$recalcRequired);
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- }
-
- /**
- * Write file version
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @throws Exception
- */
- private function _writeFileVersion(PHPExcel_Shared_XMLWriter $objWriter = null)
- {
- $objWriter->startElement('fileVersion');
- $objWriter->writeAttribute('appName', 'xl');
- $objWriter->writeAttribute('lastEdited', '4');
- $objWriter->writeAttribute('lowestEdited', '4');
- $objWriter->writeAttribute('rupBuild', '4505');
- $objWriter->endElement();
- }
-
- /**
- * Write WorkbookPr
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @throws Exception
- */
- private function _writeWorkbookPr(PHPExcel_Shared_XMLWriter $objWriter = null)
- {
- $objWriter->startElement('workbookPr');
-
- if (PHPExcel_Shared_Date::getExcelCalendar() == PHPExcel_Shared_Date::CALENDAR_MAC_1904) {
- $objWriter->writeAttribute('date1904', '1');
- }
-
- $objWriter->writeAttribute('codeName', 'ThisWorkbook');
-
- $objWriter->endElement();
- }
-
- /**
- * Write BookViews
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel $pPHPExcel
- * @throws Exception
- */
- private function _writeBookViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null)
- {
- // bookViews
- $objWriter->startElement('bookViews');
-
- // workbookView
- $objWriter->startElement('workbookView');
-
- $objWriter->writeAttribute('activeTab', $pPHPExcel->getActiveSheetIndex());
- $objWriter->writeAttribute('autoFilterDateGrouping', '1');
- $objWriter->writeAttribute('firstSheet', '0');
- $objWriter->writeAttribute('minimized', '0');
- $objWriter->writeAttribute('showHorizontalScroll', '1');
- $objWriter->writeAttribute('showSheetTabs', '1');
- $objWriter->writeAttribute('showVerticalScroll', '1');
- $objWriter->writeAttribute('tabRatio', '600');
- $objWriter->writeAttribute('visibility', 'visible');
-
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-
- /**
- * Write WorkbookProtection
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel $pPHPExcel
- * @throws Exception
- */
- private function _writeWorkbookProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null)
- {
- if ($pPHPExcel->getSecurity()->isSecurityEnabled()) {
- $objWriter->startElement('workbookProtection');
- $objWriter->writeAttribute('lockRevision', ($pPHPExcel->getSecurity()->getLockRevision() ? 'true' : 'false'));
- $objWriter->writeAttribute('lockStructure', ($pPHPExcel->getSecurity()->getLockStructure() ? 'true' : 'false'));
- $objWriter->writeAttribute('lockWindows', ($pPHPExcel->getSecurity()->getLockWindows() ? 'true' : 'false'));
-
- if ($pPHPExcel->getSecurity()->getRevisionsPassword() != '') {
- $objWriter->writeAttribute('revisionsPassword', $pPHPExcel->getSecurity()->getRevisionsPassword());
- }
-
- if ($pPHPExcel->getSecurity()->getWorkbookPassword() != '') {
- $objWriter->writeAttribute('workbookPassword', $pPHPExcel->getSecurity()->getWorkbookPassword());
- }
-
- $objWriter->endElement();
- }
- }
-
- /**
- * Write calcPr
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing
- * @throws Exception
- */
- private function _writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null, $recalcRequired = TRUE)
- {
- $objWriter->startElement('calcPr');
-
- $objWriter->writeAttribute('calcId', '124519');
- $objWriter->writeAttribute('calcMode', 'auto');
- // fullCalcOnLoad isn't needed if we've recalculating for the save
- $objWriter->writeAttribute('fullCalcOnLoad', ($recalcRequired) ? '0' : '1');
-
- $objWriter->endElement();
- }
-
- /**
- * Write sheets
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel $pPHPExcel
- * @throws Exception
- */
- private function _writeSheets(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null)
- {
- // Write sheets
- $objWriter->startElement('sheets');
- $sheetCount = $pPHPExcel->getSheetCount();
- for ($i = 0; $i < $sheetCount; ++$i) {
- // sheet
- $this->_writeSheet(
- $objWriter,
- $pPHPExcel->getSheet($i)->getTitle(),
- ($i + 1),
- ($i + 1 + 3),
- $pPHPExcel->getSheet($i)->getSheetState()
- );
- }
-
- $objWriter->endElement();
- }
-
- /**
- * Write sheet
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param string $pSheetname Sheet name
- * @param int $pSheetId Sheet id
- * @param int $pRelId Relationship ID
- * @param string $sheetState Sheet state (visible, hidden, veryHidden)
- * @throws Exception
- */
- private function _writeSheet(PHPExcel_Shared_XMLWriter $objWriter = null, $pSheetname = '', $pSheetId = 1, $pRelId = 1, $sheetState = 'visible')
- {
- if ($pSheetname != '') {
- // Write sheet
- $objWriter->startElement('sheet');
- $objWriter->writeAttribute('name', $pSheetname);
- $objWriter->writeAttribute('sheetId', $pSheetId);
- if ($sheetState != 'visible' && $sheetState != '') {
- $objWriter->writeAttribute('state', $sheetState);
- }
- $objWriter->writeAttribute('r:id', 'rId' . $pRelId);
- $objWriter->endElement();
- } else {
- throw new Exception("Invalid parameters passed.");
- }
- }
-
- /**
- * Write Defined Names
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel $pPHPExcel
- * @throws Exception
- */
- private function _writeDefinedNames(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null)
- {
- // Write defined names
- $objWriter->startElement('definedNames');
-
- // Named ranges
- if (count($pPHPExcel->getNamedRanges()) > 0) {
- // Named ranges
- $this->_writeNamedRanges($objWriter, $pPHPExcel);
- }
-
- // Other defined names
- $sheetCount = $pPHPExcel->getSheetCount();
- for ($i = 0; $i < $sheetCount; ++$i) {
- // definedName for autoFilter
- $this->_writeDefinedNameForAutofilter($objWriter, $pPHPExcel->getSheet($i), $i);
-
- // definedName for Print_Titles
- $this->_writeDefinedNameForPrintTitles($objWriter, $pPHPExcel->getSheet($i), $i);
-
- // definedName for Print_Area
- $this->_writeDefinedNameForPrintArea($objWriter, $pPHPExcel->getSheet($i), $i);
- }
-
- $objWriter->endElement();
- }
-
- /**
- * Write named ranges
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel $pPHPExcel
- * @throws Exception
- */
- private function _writeNamedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel)
- {
- // Loop named ranges
- $namedRanges = $pPHPExcel->getNamedRanges();
- foreach ($namedRanges as $namedRange) {
- $this->_writeDefinedNameForNamedRange($objWriter, $namedRange);
- }
- }
-
- /**
- * Write Defined Name for named range
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_NamedRange $pNamedRange
- * @throws Exception
- */
- private function _writeDefinedNameForNamedRange(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_NamedRange $pNamedRange)
- {
- // definedName for named range
- $objWriter->startElement('definedName');
- $objWriter->writeAttribute('name', $pNamedRange->getName());
- if ($pNamedRange->getLocalOnly()) {
- $objWriter->writeAttribute('localSheetId', $pNamedRange->getScope()->getParent()->getIndex($pNamedRange->getScope()));
- }
-
- // Create absolute coordinate and write as raw text
- $range = PHPExcel_Cell::splitRange($pNamedRange->getRange());
- for ($i = 0; $i < count($range); $i++) {
- $range[$i][0] = '\'' . str_replace("'", "''", $pNamedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteReference($range[$i][0]);
- if (isset($range[$i][1])) {
- $range[$i][1] = PHPExcel_Cell::absoluteReference($range[$i][1]);
- }
- }
- $range = PHPExcel_Cell::buildRange($range);
-
- $objWriter->writeRawData($range);
-
- $objWriter->endElement();
- }
-
- /**
- * Write Defined Name for autoFilter
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet
- * @param int $pSheetId
- * @throws Exception
- */
- private function _writeDefinedNameForAutofilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0)
- {
- // definedName for autoFilter
- $autoFilterRange = $pSheet->getAutoFilter()->getRange();
- if (!empty($autoFilterRange)) {
- $objWriter->startElement('definedName');
- $objWriter->writeAttribute('name', '_xlnm._FilterDatabase');
- $objWriter->writeAttribute('localSheetId', $pSheetId);
- $objWriter->writeAttribute('hidden', '1');
-
- // Create absolute coordinate and write as raw text
- $range = PHPExcel_Cell::splitRange($autoFilterRange);
- $range = $range[0];
- // Strip any worksheet ref so we can make the cell ref absolute
- if (strpos($range[0],'!') !== false) {
- list($ws,$range[0]) = explode('!',$range[0]);
- }
-
- $range[0] = PHPExcel_Cell::absoluteCoordinate($range[0]);
- $range[1] = PHPExcel_Cell::absoluteCoordinate($range[1]);
- $range = implode(':', $range);
-
- $objWriter->writeRawData('\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . $range);
-
- $objWriter->endElement();
- }
- }
-
- /**
- * Write Defined Name for PrintTitles
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet
- * @param int $pSheetId
- * @throws Exception
- */
- private function _writeDefinedNameForPrintTitles(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0)
- {
- // definedName for PrintTitles
- if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
- $objWriter->startElement('definedName');
- $objWriter->writeAttribute('name', '_xlnm.Print_Titles');
- $objWriter->writeAttribute('localSheetId', $pSheetId);
-
- // Setting string
- $settingString = '';
-
- // Columns to repeat
- if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) {
- $repeat = $pSheet->getPageSetup()->getColumnsToRepeatAtLeft();
-
- $settingString .= '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!$' . $repeat[0] . ':$' . $repeat[1];
- }
-
- // Rows to repeat
- if ($pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
- if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) {
- $settingString .= ',';
- }
-
- $repeat = $pSheet->getPageSetup()->getRowsToRepeatAtTop();
-
- $settingString .= '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!$' . $repeat[0] . ':$' . $repeat[1];
- }
-
- $objWriter->writeRawData($settingString);
-
- $objWriter->endElement();
- }
- }
-
- /**
- * Write Defined Name for PrintTitles
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet
- * @param int $pSheetId
- * @throws Exception
- */
- private function _writeDefinedNameForPrintArea(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0)
- {
- // definedName for PrintArea
- if ($pSheet->getPageSetup()->isPrintAreaSet()) {
- $objWriter->startElement('definedName');
- $objWriter->writeAttribute('name', '_xlnm.Print_Area');
- $objWriter->writeAttribute('localSheetId', $pSheetId);
-
- // Setting string
- $settingString = '';
-
- // Print area
- $printArea = PHPExcel_Cell::splitRange($pSheet->getPageSetup()->getPrintArea());
-
- $chunks = array();
- foreach ($printArea as $printAreaRect) {
- $printAreaRect[0] = PHPExcel_Cell::absoluteReference($printAreaRect[0]);
- $printAreaRect[1] = PHPExcel_Cell::absoluteReference($printAreaRect[1]);
- $chunks[] = '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . implode(':', $printAreaRect);
- }
-
- $objWriter->writeRawData(implode(',', $chunks));
-
- $objWriter->endElement();
- }
- }
-}
diff --git a/admin/survey/excel/PHPExcel/Writer/Excel2007/Worksheet.php b/admin/survey/excel/PHPExcel/Writer/Excel2007/Worksheet.php deleted file mode 100644 index 9f4839b..0000000 --- a/admin/survey/excel/PHPExcel/Writer/Excel2007/Worksheet.php +++ /dev/null @@ -1,1215 +0,0 @@ -<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2012 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
- * @version 1.7.8, 2012-10-12
- */
-
-
-/**
- * PHPExcel_Writer_Excel2007_Worksheet
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_WriterPart
-{
- /**
- * Write worksheet to XML format
- *
- * @param PHPExcel_Worksheet $pSheet
- * @param string[] $pStringTable
- * @param boolean $includeCharts Flag indicating if we should write charts
- * @return string XML Output
- * @throws Exception
- */
- public function writeWorksheet($pSheet = null, $pStringTable = null, $includeCharts = FALSE)
- {
- if (!is_null($pSheet)) {
- // Create XML writer
- $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);
- }
-
- // XML header
- $objWriter->startDocument('1.0','UTF-8','yes');
-
- // Worksheet
- $objWriter->startElement('worksheet');
- $objWriter->writeAttribute('xml:space', 'preserve');
- $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
- $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
-
- // sheetPr
- $this->_writeSheetPr($objWriter, $pSheet);
-
- // Dimension
- $this->_writeDimension($objWriter, $pSheet);
-
- // sheetViews
- $this->_writeSheetViews($objWriter, $pSheet);
-
- // sheetFormatPr
- $this->_writeSheetFormatPr($objWriter, $pSheet);
-
- // cols
- $this->_writeCols($objWriter, $pSheet);
-
- // sheetData
- $this->_writeSheetData($objWriter, $pSheet, $pStringTable);
-
- // sheetProtection
- $this->_writeSheetProtection($objWriter, $pSheet);
-
- // protectedRanges
- $this->_writeProtectedRanges($objWriter, $pSheet);
-
- // autoFilter
- $this->_writeAutoFilter($objWriter, $pSheet);
-
- // mergeCells
- $this->_writeMergeCells($objWriter, $pSheet);
-
- // conditionalFormatting
- $this->_writeConditionalFormatting($objWriter, $pSheet);
-
- // dataValidations
- $this->_writeDataValidations($objWriter, $pSheet);
-
- // hyperlinks
- $this->_writeHyperlinks($objWriter, $pSheet);
-
- // Print options
- $this->_writePrintOptions($objWriter, $pSheet);
-
- // Page margins
- $this->_writePageMargins($objWriter, $pSheet);
-
- // Page setup
- $this->_writePageSetup($objWriter, $pSheet);
-
- // Header / footer
- $this->_writeHeaderFooter($objWriter, $pSheet);
-
- // Breaks
- $this->_writeBreaks($objWriter, $pSheet);
-
- // Drawings and/or Charts
- $this->_writeDrawings($objWriter, $pSheet, $includeCharts);
-
- // LegacyDrawing
- $this->_writeLegacyDrawing($objWriter, $pSheet);
-
- // LegacyDrawingHF
- $this->_writeLegacyDrawingHF($objWriter, $pSheet);
-
- $objWriter->endElement();
-
- // Return
- return $objWriter->getData();
- } else {
- throw new Exception("Invalid PHPExcel_Worksheet object passed.");
- }
- }
-
- /**
- * Write SheetPr
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeSheetPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // sheetPr
- $objWriter->startElement('sheetPr');
- //$objWriter->writeAttribute('codeName', $pSheet->getTitle());
- $autoFilterRange = $pSheet->getAutoFilter()->getRange();
- if (!empty($autoFilterRange)) {
- $objWriter->writeAttribute('filterMode', 1);
- $pSheet->getAutoFilter()->showHideRows();
- }
-
- // tabColor
- if ($pSheet->isTabColorSet()) {
- $objWriter->startElement('tabColor');
- $objWriter->writeAttribute('rgb', $pSheet->getTabColor()->getARGB());
- $objWriter->endElement();
- }
-
- // outlinePr
- $objWriter->startElement('outlinePr');
- $objWriter->writeAttribute('summaryBelow', ($pSheet->getShowSummaryBelow() ? '1' : '0'));
- $objWriter->writeAttribute('summaryRight', ($pSheet->getShowSummaryRight() ? '1' : '0'));
- $objWriter->endElement();
-
- // pageSetUpPr
- if ($pSheet->getPageSetup()->getFitToPage()) {
- $objWriter->startElement('pageSetUpPr');
- $objWriter->writeAttribute('fitToPage', '1');
- $objWriter->endElement();
- }
-
- $objWriter->endElement();
- }
-
- /**
- * Write Dimension
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeDimension(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // dimension
- $objWriter->startElement('dimension');
- $objWriter->writeAttribute('ref', $pSheet->calculateWorksheetDimension());
- $objWriter->endElement();
- }
-
- /**
- * Write SheetViews
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeSheetViews(PHPExcel_Shared_XMLWriter $objWriter = NULL, PHPExcel_Worksheet $pSheet = NULL)
- {
- // sheetViews
- $objWriter->startElement('sheetViews');
-
- // Sheet selected?
- $sheetSelected = false;
- if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex())
- $sheetSelected = true;
-
-
- // sheetView
- $objWriter->startElement('sheetView');
- $objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0');
- $objWriter->writeAttribute('workbookViewId', '0');
-
- // Zoom scales
- if ($pSheet->getSheetView()->getZoomScale() != 100) {
- $objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale());
- }
- if ($pSheet->getSheetView()->getZoomScaleNormal() != 100) {
- $objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal());
- }
-
- // View Layout Type
- if ($pSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL) {
- $objWriter->writeAttribute('view', $pSheet->getSheetView()->getView());
- }
-
- // Gridlines
- if ($pSheet->getShowGridlines()) {
- $objWriter->writeAttribute('showGridLines', 'true');
- } else {
- $objWriter->writeAttribute('showGridLines', 'false');
- }
-
- // Row and column headers
- if ($pSheet->getShowRowColHeaders()) {
- $objWriter->writeAttribute('showRowColHeaders', '1');
- } else {
- $objWriter->writeAttribute('showRowColHeaders', '0');
- }
-
- // Right-to-left
- if ($pSheet->getRightToLeft()) {
- $objWriter->writeAttribute('rightToLeft', 'true');
- }
-
- $activeCell = $pSheet->getActiveCell();
-
- // Pane
- $pane = '';
- $topLeftCell = $pSheet->getFreezePane();
- if (($topLeftCell != '') && ($topLeftCell != 'A1')) {
- $activeCell = $topLeftCell;
- // Calculate freeze coordinates
- $xSplit = $ySplit = 0;
-
- list($xSplit, $ySplit) = PHPExcel_Cell::coordinateFromString($topLeftCell);
- $xSplit = PHPExcel_Cell::columnIndexFromString($xSplit);
-
- // pane
- $pane = 'topRight';
- $objWriter->startElement('pane');
- if ($xSplit > 1)
- $objWriter->writeAttribute('xSplit', $xSplit - 1);
- if ($ySplit > 1) {
- $objWriter->writeAttribute('ySplit', $ySplit - 1);
- $pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft';
- }
- $objWriter->writeAttribute('topLeftCell', $topLeftCell);
- $objWriter->writeAttribute('activePane', $pane);
- $objWriter->writeAttribute('state', 'frozen');
- $objWriter->endElement();
-
- if (($xSplit > 1) && ($ySplit > 1)) {
- // Write additional selections if more than two panes (ie both an X and a Y split)
- $objWriter->startElement('selection'); $objWriter->writeAttribute('pane', 'topRight'); $objWriter->endElement();
- $objWriter->startElement('selection'); $objWriter->writeAttribute('pane', 'bottomLeft'); $objWriter->endElement();
- }
- }
-
- // Selection
-// if ($pane != '') {
- // Only need to write selection element if we have a split pane
- // We cheat a little by over-riding the active cell selection, setting it to the split cell
- $objWriter->startElement('selection');
- if ($pane != '') {
- $objWriter->writeAttribute('pane', $pane);
- }
- $objWriter->writeAttribute('activeCell', $activeCell);
- $objWriter->writeAttribute('sqref', $activeCell);
- $objWriter->endElement();
-// }
-
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
-
- /**
- * Write SheetFormatPr
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeSheetFormatPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // sheetFormatPr
- $objWriter->startElement('sheetFormatPr');
-
- // Default row height
- if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) {
- $objWriter->writeAttribute('customHeight', 'true');
- $objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight()));
- } else {
- $objWriter->writeAttribute('defaultRowHeight', '14.4');
- }
-
- // Set Zero Height row
- if ((string)$pSheet->getDefaultRowDimension()->getzeroHeight() == '1' ||
- strtolower((string)$pSheet->getDefaultRowDimension()->getzeroHeight()) == 'true' ) {
- $objWriter->writeAttribute('zeroHeight', '1');
- }
-
- // Default column width
- if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) {
- $objWriter->writeAttribute('defaultColWidth', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth()));
- }
-
- // Outline level - row
- $outlineLevelRow = 0;
- foreach ($pSheet->getRowDimensions() as $dimension) {
- if ($dimension->getOutlineLevel() > $outlineLevelRow) {
- $outlineLevelRow = $dimension->getOutlineLevel();
- }
- }
- $objWriter->writeAttribute('outlineLevelRow', (int)$outlineLevelRow);
-
- // Outline level - column
- $outlineLevelCol = 0;
- foreach ($pSheet->getColumnDimensions() as $dimension) {
- if ($dimension->getOutlineLevel() > $outlineLevelCol) {
- $outlineLevelCol = $dimension->getOutlineLevel();
- }
- }
- $objWriter->writeAttribute('outlineLevelCol', (int)$outlineLevelCol);
-
- $objWriter->endElement();
- }
-
- /**
- * Write Cols
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // cols
- if (count($pSheet->getColumnDimensions()) > 0) {
- $objWriter->startElement('cols');
-
- $pSheet->calculateColumnWidths();
-
- // Loop through column dimensions
- foreach ($pSheet->getColumnDimensions() as $colDimension) {
- // col
- $objWriter->startElement('col');
- $objWriter->writeAttribute('min', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex()));
- $objWriter->writeAttribute('max', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex()));
-
- if ($colDimension->getWidth() < 0) {
- // No width set, apply default of 10
- $objWriter->writeAttribute('width', '9.10');
- } else {
- // Width set
- $objWriter->writeAttribute('width', PHPExcel_Shared_String::FormatNumber($colDimension->getWidth()));
- }
-
- // Column visibility
- if ($colDimension->getVisible() == false) {
- $objWriter->writeAttribute('hidden', 'true');
- }
-
- // Auto size?
- if ($colDimension->getAutoSize()) {
- $objWriter->writeAttribute('bestFit', 'true');
- }
-
- // Custom width?
- if ($colDimension->getWidth() != $pSheet->getDefaultColumnDimension()->getWidth()) {
- $objWriter->writeAttribute('customWidth', 'true');
- }
-
- // Collapsed
- if ($colDimension->getCollapsed() == true) {
- $objWriter->writeAttribute('collapsed', 'true');
- }
-
- // Outline level
- if ($colDimension->getOutlineLevel() > 0) {
- $objWriter->writeAttribute('outlineLevel', $colDimension->getOutlineLevel());
- }
-
- // Style
- $objWriter->writeAttribute('style', $colDimension->getXfIndex());
-
- $objWriter->endElement();
- }
-
- $objWriter->endElement();
- }
- }
-
- /**
- * Write SheetProtection
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeSheetProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // sheetProtection
- $objWriter->startElement('sheetProtection');
-
- if ($pSheet->getProtection()->getPassword() != '') {
- $objWriter->writeAttribute('password', $pSheet->getProtection()->getPassword());
- }
-
- $objWriter->writeAttribute('sheet', ($pSheet->getProtection()->getSheet() ? 'true' : 'false'));
- $objWriter->writeAttribute('objects', ($pSheet->getProtection()->getObjects() ? 'true' : 'false'));
- $objWriter->writeAttribute('scenarios', ($pSheet->getProtection()->getScenarios() ? 'true' : 'false'));
- $objWriter->writeAttribute('formatCells', ($pSheet->getProtection()->getFormatCells() ? 'true' : 'false'));
- $objWriter->writeAttribute('formatColumns', ($pSheet->getProtection()->getFormatColumns() ? 'true' : 'false'));
- $objWriter->writeAttribute('formatRows', ($pSheet->getProtection()->getFormatRows() ? 'true' : 'false'));
- $objWriter->writeAttribute('insertColumns', ($pSheet->getProtection()->getInsertColumns() ? 'true' : 'false'));
- $objWriter->writeAttribute('insertRows', ($pSheet->getProtection()->getInsertRows() ? 'true' : 'false'));
- $objWriter->writeAttribute('insertHyperlinks', ($pSheet->getProtection()->getInsertHyperlinks() ? 'true' : 'false'));
- $objWriter->writeAttribute('deleteColumns', ($pSheet->getProtection()->getDeleteColumns() ? 'true' : 'false'));
- $objWriter->writeAttribute('deleteRows', ($pSheet->getProtection()->getDeleteRows() ? 'true' : 'false'));
- $objWriter->writeAttribute('selectLockedCells', ($pSheet->getProtection()->getSelectLockedCells() ? 'true' : 'false'));
- $objWriter->writeAttribute('sort', ($pSheet->getProtection()->getSort() ? 'true' : 'false'));
- $objWriter->writeAttribute('autoFilter', ($pSheet->getProtection()->getAutoFilter() ? 'true' : 'false'));
- $objWriter->writeAttribute('pivotTables', ($pSheet->getProtection()->getPivotTables() ? 'true' : 'false'));
- $objWriter->writeAttribute('selectUnlockedCells', ($pSheet->getProtection()->getSelectUnlockedCells() ? 'true' : 'false'));
- $objWriter->endElement();
- }
-
- /**
- * Write ConditionalFormatting
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeConditionalFormatting(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // Conditional id
- $id = 1;
-
- // Loop through styles in the current worksheet
- foreach ($pSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) {
- foreach ($conditionalStyles as $conditional) {
- // WHY was this again?
- // if ($this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode( $conditional->getHashCode() ) == '') {
- // continue;
- // }
- if ($conditional->getConditionType() != PHPExcel_Style_Conditional::CONDITION_NONE) {
- // conditionalFormatting
- $objWriter->startElement('conditionalFormatting');
- $objWriter->writeAttribute('sqref', $cellCoordinate);
-
- // cfRule
- $objWriter->startElement('cfRule');
- $objWriter->writeAttribute('type', $conditional->getConditionType());
- $objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode( $conditional->getHashCode() ));
- $objWriter->writeAttribute('priority', $id++);
-
- if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
- ||
- $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
- && $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) {
- $objWriter->writeAttribute('operator', $conditional->getOperatorType());
- }
-
- if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
- && !is_null($conditional->getText())) {
- $objWriter->writeAttribute('text', $conditional->getText());
- }
-
- if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
- && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT
- && !is_null($conditional->getText())) {
- $objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))');
- } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
- && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH
- && !is_null($conditional->getText())) {
- $objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
- } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
- && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH
- && !is_null($conditional->getText())) {
- $objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
- } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
- && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS
- && !is_null($conditional->getText())) {
- $objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))');
- } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
- || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
- || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
- foreach ($conditional->getConditions() as $formula) {
- // Formula
- $objWriter->writeElement('formula', $formula);
- }
- }
-
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
- }
- }
- }
-
- /**
- * Write DataValidations
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeDataValidations(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // Datavalidation collection
- $dataValidationCollection = $pSheet->getDataValidationCollection();
-
- // Write data validations?
- if (!empty($dataValidationCollection)) {
- $objWriter->startElement('dataValidations');
- $objWriter->writeAttribute('count', count($dataValidationCollection));
-
- foreach ($dataValidationCollection as $coordinate => $dv) {
- $objWriter->startElement('dataValidation');
-
- if ($dv->getType() != '') {
- $objWriter->writeAttribute('type', $dv->getType());
- }
-
- if ($dv->getErrorStyle() != '') {
- $objWriter->writeAttribute('errorStyle', $dv->getErrorStyle());
- }
-
- if ($dv->getOperator() != '') {
- $objWriter->writeAttribute('operator', $dv->getOperator());
- }
-
- $objWriter->writeAttribute('allowBlank', ($dv->getAllowBlank() ? '1' : '0'));
- $objWriter->writeAttribute('showDropDown', (!$dv->getShowDropDown() ? '1' : '0'));
- $objWriter->writeAttribute('showInputMessage', ($dv->getShowInputMessage() ? '1' : '0'));
- $objWriter->writeAttribute('showErrorMessage', ($dv->getShowErrorMessage() ? '1' : '0'));
-
- if ($dv->getErrorTitle() !== '') {
- $objWriter->writeAttribute('errorTitle', $dv->getErrorTitle());
- }
- if ($dv->getError() !== '') {
- $objWriter->writeAttribute('error', $dv->getError());
- }
- if ($dv->getPromptTitle() !== '') {
- $objWriter->writeAttribute('promptTitle', $dv->getPromptTitle());
- }
- if ($dv->getPrompt() !== '') {
- $objWriter->writeAttribute('prompt', $dv->getPrompt());
- }
-
- $objWriter->writeAttribute('sqref', $coordinate);
-
- if ($dv->getFormula1() !== '') {
- $objWriter->writeElement('formula1', $dv->getFormula1());
- }
- if ($dv->getFormula2() !== '') {
- $objWriter->writeElement('formula2', $dv->getFormula2());
- }
-
- $objWriter->endElement();
- }
-
- $objWriter->endElement();
- }
- }
-
- /**
- * Write Hyperlinks
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeHyperlinks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // Hyperlink collection
- $hyperlinkCollection = $pSheet->getHyperlinkCollection();
-
- // Relation ID
- $relationId = 1;
-
- // Write hyperlinks?
- if (!empty($hyperlinkCollection)) {
- $objWriter->startElement('hyperlinks');
-
- foreach ($hyperlinkCollection as $coordinate => $hyperlink) {
- $objWriter->startElement('hyperlink');
-
- $objWriter->writeAttribute('ref', $coordinate);
- if (!$hyperlink->isInternal()) {
- $objWriter->writeAttribute('r:id', 'rId_hyperlink_' . $relationId);
- ++$relationId;
- } else {
- $objWriter->writeAttribute('location', str_replace('sheet://', '', $hyperlink->getUrl()));
- }
-
- if ($hyperlink->getTooltip() != '') {
- $objWriter->writeAttribute('tooltip', $hyperlink->getTooltip());
- }
-
- $objWriter->endElement();
- }
-
- $objWriter->endElement();
- }
- }
-
- /**
- * Write ProtectedRanges
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeProtectedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- if (count($pSheet->getProtectedCells()) > 0) {
- // protectedRanges
- $objWriter->startElement('protectedRanges');
-
- // Loop protectedRanges
- foreach ($pSheet->getProtectedCells() as $protectedCell => $passwordHash) {
- // protectedRange
- $objWriter->startElement('protectedRange');
- $objWriter->writeAttribute('name', 'p' . md5($protectedCell));
- $objWriter->writeAttribute('sqref', $protectedCell);
- $objWriter->writeAttribute('password', $passwordHash);
- $objWriter->endElement();
- }
-
- $objWriter->endElement();
- }
- }
-
- /**
- * Write MergeCells
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeMergeCells(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- if (count($pSheet->getMergeCells()) > 0) {
- // mergeCells
- $objWriter->startElement('mergeCells');
-
- // Loop mergeCells
- foreach ($pSheet->getMergeCells() as $mergeCell) {
- // mergeCell
- $objWriter->startElement('mergeCell');
- $objWriter->writeAttribute('ref', $mergeCell);
- $objWriter->endElement();
- }
-
- $objWriter->endElement();
- }
- }
-
- /**
- * Write PrintOptions
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writePrintOptions(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // printOptions
- $objWriter->startElement('printOptions');
-
- $objWriter->writeAttribute('gridLines', ($pSheet->getPrintGridlines() ? 'true': 'false'));
- $objWriter->writeAttribute('gridLinesSet', 'true');
-
- if ($pSheet->getPageSetup()->getHorizontalCentered()) {
- $objWriter->writeAttribute('horizontalCentered', 'true');
- }
-
- if ($pSheet->getPageSetup()->getVerticalCentered()) {
- $objWriter->writeAttribute('verticalCentered', 'true');
- }
-
- $objWriter->endElement();
- }
-
- /**
- * Write PageMargins
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writePageMargins(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // pageMargins
- $objWriter->startElement('pageMargins');
- $objWriter->writeAttribute('left', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft()));
- $objWriter->writeAttribute('right', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight()));
- $objWriter->writeAttribute('top', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop()));
- $objWriter->writeAttribute('bottom', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom()));
- $objWriter->writeAttribute('header', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getHeader()));
- $objWriter->writeAttribute('footer', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getFooter()));
- $objWriter->endElement();
- }
-
- /**
- * Write AutoFilter
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeAutoFilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- $autoFilterRange = $pSheet->getAutoFilter()->getRange();
- if (!empty($autoFilterRange)) {
- // autoFilter
- $objWriter->startElement('autoFilter');
-
- // Strip any worksheet reference from the filter coordinates
- $range = PHPExcel_Cell::splitRange($autoFilterRange);
- $range = $range[0];
- // Strip any worksheet ref
- if (strpos($range[0],'!') !== false) {
- list($ws,$range[0]) = explode('!',$range[0]);
- }
- $range = implode(':', $range);
-
- $objWriter->writeAttribute('ref', str_replace('$','',$range));
-
- $columns = $pSheet->getAutoFilter()->getColumns();
- if (count($columns > 0)) {
- foreach($columns as $columnID => $column) {
- $rules = $column->getRules();
- if (count($rules > 0)) {
- $objWriter->startElement('filterColumn');
- $objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID));
-
- $objWriter->startElement( $column->getFilterType());
- if ($column->getJoin() == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND) {
- $objWriter->writeAttribute('and', 1);
- }
-
- foreach ($rules as $rule) {
- if (($column->getFilterType() === PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER) &&
- ($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) &&
- ($rule->getValue() === '')) {
- // Filter rule for Blanks
- $objWriter->writeAttribute('blank', 1);
- } elseif($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) {
- // Dynamic Filter Rule
- $objWriter->writeAttribute('type', $rule->getGrouping());
- $val = $column->getAttribute('val');
- if ($val !== NULL) {
- $objWriter->writeAttribute('val', $val);
- }
- $maxVal = $column->getAttribute('maxVal');
- if ($maxVal !== NULL) {
- $objWriter->writeAttribute('maxVal', $maxVal);
- }
- } elseif($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) {
- // Top 10 Filter Rule
- $objWriter->writeAttribute('val', $rule->getValue());
- $objWriter->writeAttribute('percent', (($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0'));
- $objWriter->writeAttribute('top', (($rule->getGrouping() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0'));
- } else {
- // Filter, DateGroupItem or CustomFilter
- $objWriter->startElement($rule->getRuleType());
-
- if ($rule->getOperator() !== PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) {
- $objWriter->writeAttribute('operator', $rule->getOperator());
- }
- if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) {
- // Date Group filters
- foreach($rule->getValue() as $key => $value) {
- if ($value > '') $objWriter->writeAttribute($key, $value);
- }
- $objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
- } else {
- $objWriter->writeAttribute('val', $rule->getValue());
- }
-
- $objWriter->endElement();
- }
- }
-
- $objWriter->endElement();
-
- $objWriter->endElement();
- }
- }
- }
-
- $objWriter->endElement();
- }
- }
-
- /**
- * Write PageSetup
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writePageSetup(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // pageSetup
- $objWriter->startElement('pageSetup');
- $objWriter->writeAttribute('paperSize', $pSheet->getPageSetup()->getPaperSize());
- $objWriter->writeAttribute('orientation', $pSheet->getPageSetup()->getOrientation());
-
- if (!is_null($pSheet->getPageSetup()->getScale())) {
- $objWriter->writeAttribute('scale', $pSheet->getPageSetup()->getScale());
- }
- if (!is_null($pSheet->getPageSetup()->getFitToHeight())) {
- $objWriter->writeAttribute('fitToHeight', $pSheet->getPageSetup()->getFitToHeight());
- } else {
- $objWriter->writeAttribute('fitToHeight', '0');
- }
- if (!is_null($pSheet->getPageSetup()->getFitToWidth())) {
- $objWriter->writeAttribute('fitToWidth', $pSheet->getPageSetup()->getFitToWidth());
- } else {
- $objWriter->writeAttribute('fitToWidth', '0');
- }
- if (!is_null($pSheet->getPageSetup()->getFirstPageNumber())) {
- $objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber());
- $objWriter->writeAttribute('useFirstPageNumber', '1');
- }
-
- $objWriter->endElement();
- }
-
- /**
- * Write Header / Footer
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeHeaderFooter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // headerFooter
- $objWriter->startElement('headerFooter');
- $objWriter->writeAttribute('differentOddEven', ($pSheet->getHeaderFooter()->getDifferentOddEven() ? 'true' : 'false'));
- $objWriter->writeAttribute('differentFirst', ($pSheet->getHeaderFooter()->getDifferentFirst() ? 'true' : 'false'));
- $objWriter->writeAttribute('scaleWithDoc', ($pSheet->getHeaderFooter()->getScaleWithDocument() ? 'true' : 'false'));
- $objWriter->writeAttribute('alignWithMargins', ($pSheet->getHeaderFooter()->getAlignWithMargins() ? 'true' : 'false'));
-
- $objWriter->writeElement('oddHeader', $pSheet->getHeaderFooter()->getOddHeader());
- $objWriter->writeElement('oddFooter', $pSheet->getHeaderFooter()->getOddFooter());
- $objWriter->writeElement('evenHeader', $pSheet->getHeaderFooter()->getEvenHeader());
- $objWriter->writeElement('evenFooter', $pSheet->getHeaderFooter()->getEvenFooter());
- $objWriter->writeElement('firstHeader', $pSheet->getHeaderFooter()->getFirstHeader());
- $objWriter->writeElement('firstFooter', $pSheet->getHeaderFooter()->getFirstFooter());
- $objWriter->endElement();
- }
-
- /**
- * Write Breaks
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeBreaks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // Get row and column breaks
- $aRowBreaks = array();
- $aColumnBreaks = array();
- foreach ($pSheet->getBreaks() as $cell => $breakType) {
- if ($breakType == PHPExcel_Worksheet::BREAK_ROW) {
- $aRowBreaks[] = $cell;
- } else if ($breakType == PHPExcel_Worksheet::BREAK_COLUMN) {
- $aColumnBreaks[] = $cell;
- }
- }
-
- // rowBreaks
- if (!empty($aRowBreaks)) {
- $objWriter->startElement('rowBreaks');
- $objWriter->writeAttribute('count', count($aRowBreaks));
- $objWriter->writeAttribute('manualBreakCount', count($aRowBreaks));
-
- foreach ($aRowBreaks as $cell) {
- $coords = PHPExcel_Cell::coordinateFromString($cell);
-
- $objWriter->startElement('brk');
- $objWriter->writeAttribute('id', $coords[1]);
- $objWriter->writeAttribute('man', '1');
- $objWriter->endElement();
- }
-
- $objWriter->endElement();
- }
-
- // Second, write column breaks
- if (!empty($aColumnBreaks)) {
- $objWriter->startElement('colBreaks');
- $objWriter->writeAttribute('count', count($aColumnBreaks));
- $objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks));
-
- foreach ($aColumnBreaks as $cell) {
- $coords = PHPExcel_Cell::coordinateFromString($cell);
-
- $objWriter->startElement('brk');
- $objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1);
- $objWriter->writeAttribute('man', '1');
- $objWriter->endElement();
- }
-
- $objWriter->endElement();
- }
- }
-
- /**
- * Write SheetData
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @param string[] $pStringTable String table
- * @throws Exception
- */
- private function _writeSheetData(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pStringTable = null)
- {
- if (is_array($pStringTable)) {
- // Flipped stringtable, for faster index searching
- $aFlippedStringTable = $this->getParentWriter()->getWriterPart('stringtable')->flipStringTable($pStringTable);
-
- // sheetData
- $objWriter->startElement('sheetData');
-
- // Get column count
- $colCount = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn());
-
- // Highest row number
- $highestRow = $pSheet->getHighestRow();
-
- // Loop through cells
- $cellsByRow = array();
- foreach ($pSheet->getCellCollection() as $cellID) {
- $cellAddress = PHPExcel_Cell::coordinateFromString($cellID);
- $cellsByRow[$cellAddress[1]][] = $cellID;
- }
-
- $currentRow = 0;
- while($currentRow++ < $highestRow) {
- // Get row dimension
- $rowDimension = $pSheet->getRowDimension($currentRow);
-
- // Write current row?
- $writeCurrentRow = isset($cellsByRow[$currentRow]) ||
- $rowDimension->getRowHeight() >= 0 ||
- $rowDimension->getVisible() == false ||
- $rowDimension->getCollapsed() == true ||
- $rowDimension->getOutlineLevel() > 0 ||
- $rowDimension->getXfIndex() !== null;
-
- if ($writeCurrentRow) {
- // Start a new row
- $objWriter->startElement('row');
- $objWriter->writeAttribute('r', $currentRow);
- $objWriter->writeAttribute('spans', '1:' . $colCount);
-
- // Row dimensions
- if ($rowDimension->getRowHeight() >= 0) {
- $objWriter->writeAttribute('customHeight', '1');
- $objWriter->writeAttribute('ht', PHPExcel_Shared_String::FormatNumber($rowDimension->getRowHeight()));
- }
-
- // Row visibility
- if ($rowDimension->getVisible() == false) {
- $objWriter->writeAttribute('hidden', 'true');
- }
-
- // Collapsed
- if ($rowDimension->getCollapsed() == true) {
- $objWriter->writeAttribute('collapsed', 'true');
- }
-
- // Outline level
- if ($rowDimension->getOutlineLevel() > 0) {
- $objWriter->writeAttribute('outlineLevel', $rowDimension->getOutlineLevel());
- }
-
- // Style
- if ($rowDimension->getXfIndex() !== null) {
- $objWriter->writeAttribute('s', $rowDimension->getXfIndex());
- $objWriter->writeAttribute('customFormat', '1');
- }
-
- // Write cells
- if (isset($cellsByRow[$currentRow])) {
- foreach($cellsByRow[$currentRow] as $cellAddress) {
- // Write cell
- $this->_writeCell($objWriter, $pSheet, $cellAddress, $pStringTable, $aFlippedStringTable);
- }
- }
-
- // End row
- $objWriter->endElement();
- }
- }
-
- $objWriter->endElement();
- } else {
- throw new Exception("Invalid parameters passed.");
- }
- }
-
- /**
- * Write Cell
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @param PHPExcel_Cell $pCellAddress Cell Address
- * @param string[] $pStringTable String table
- * @param string[] $pFlippedStringTable String table (flipped), for faster index searching
- * @throws Exception
- */
- 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)) {
- // Cell
- $pCell = $pSheet->getCell($pCellAddress);
- $objWriter->startElement('c');
- $objWriter->writeAttribute('r', $pCellAddress);
-
- // Sheet styles
- if ($pCell->getXfIndex() != '') {
- $objWriter->writeAttribute('s', $pCell->getXfIndex());
- }
-
- // If cell value is supplied, write cell value
- $cellValue = $pCell->getValue();
- if (is_object($cellValue) || $cellValue !== '') {
- // Map type
- $mappedType = $pCell->getDataType();
-
- // Write data type depending on its type
- switch (strtolower($mappedType)) {
- case 'inlinestr': // Inline string
- case 's': // String
- case 'b': // Boolean
- $objWriter->writeAttribute('t', $mappedType);
- break;
- case 'f': // Formula
- $calculatedValue = null;
- if ($this->getParentWriter()->getPreCalculateFormulas()) {
- $calculatedValue = $pCell->getCalculatedValue();
- } else {
- $calculatedValue = $cellValue;
- }
- if (is_string($calculatedValue)) {
- $objWriter->writeAttribute('t', 'str');
- }
- break;
- case 'e': // Error
- $objWriter->writeAttribute('t', $mappedType);
- }
-
- // Write data depending on its type
- switch (strtolower($mappedType)) {
- case 'inlinestr': // Inline string
- if (! $cellValue instanceof PHPExcel_RichText) {
- $objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML( htmlspecialchars($cellValue) ) );
- } else if ($cellValue instanceof PHPExcel_RichText) {
- $objWriter->startElement('is');
- $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue);
- $objWriter->endElement();
- }
-
- break;
- case 's': // String
- if (! $cellValue instanceof PHPExcel_RichText) {
- if (isset($pFlippedStringTable[$cellValue])) {
- $objWriter->writeElement('v', $pFlippedStringTable[$cellValue]);
- }
- } else if ($cellValue instanceof PHPExcel_RichText) {
- $objWriter->writeElement('v', $pFlippedStringTable[$cellValue->getHashCode()]);
- }
-
- break;
- case 'f': // Formula
- $attributes = $pCell->getFormulaAttributes();
- if($attributes['t'] == 'array') {
- $objWriter->startElement('f');
- $objWriter->writeAttribute('t', 'array');
- $objWriter->writeAttribute('ref', $pCellAddress);
- $objWriter->writeAttribute('aca', '1');
- $objWriter->writeAttribute('ca', '1');
- $objWriter->text(substr($cellValue, 1));
- $objWriter->endElement();
- } else {
- $objWriter->writeElement('f', substr($cellValue, 1));
- }
- if ($this->getParentWriter()->getOffice2003Compatibility() === false) {
- if ($this->getParentWriter()->getPreCalculateFormulas()) {
- $calculatedValue = $pCell->getCalculatedValue();
- if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') {
- $objWriter->writeElement('v', PHPExcel_Shared_String::FormatNumber($calculatedValue));
- } else {
- $objWriter->writeElement('v', '0');
- }
- } else {
- $objWriter->writeElement('v', '0');
- }
- }
- break;
- case 'n': // Numeric
- // force point as decimal separator in case current locale uses comma
- $objWriter->writeElement('v', str_replace(',', '.', $cellValue));
- break;
- case 'b': // Boolean
- $objWriter->writeElement('v', ($cellValue ? '1' : '0'));
- break;
- case 'e': // Error
- if (substr($cellValue, 0, 1) == '=') {
- $objWriter->writeElement('f', substr($cellValue, 1));
- $objWriter->writeElement('v', substr($cellValue, 1));
- } else {
- $objWriter->writeElement('v', $cellValue);
- }
-
- break;
- }
- }
-
- $objWriter->endElement();
- } else {
- throw new Exception("Invalid parameters passed.");
- }
- }
-
- /**
- * Write Drawings
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @param boolean $includeCharts Flag indicating if we should include drawing details for charts
- * @throws Exception
- */
- private function _writeDrawings(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $includeCharts = FALSE)
- {
- $chartCount = ($includeCharts) ? $pSheet->getChartCollection()->count() : 0;
- // If sheet contains drawings, add the relationships
- if (($pSheet->getDrawingCollection()->count() > 0) ||
- ($chartCount > 0)) {
- $objWriter->startElement('drawing');
- $objWriter->writeAttribute('r:id', 'rId1');
- $objWriter->endElement();
- }
- }
-
- /**
- * Write LegacyDrawing
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeLegacyDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // If sheet contains comments, add the relationships
- if (count($pSheet->getComments()) > 0) {
- $objWriter->startElement('legacyDrawing');
- $objWriter->writeAttribute('r:id', 'rId_comments_vml1');
- $objWriter->endElement();
- }
- }
-
- /**
- * Write LegacyDrawingHF
- *
- * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
- * @param PHPExcel_Worksheet $pSheet Worksheet
- * @throws Exception
- */
- private function _writeLegacyDrawingHF(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
- {
- // If sheet contains images, add the relationships
- if (count($pSheet->getHeaderFooter()->getImages()) > 0) {
- $objWriter->startElement('legacyDrawingHF');
- $objWriter->writeAttribute('r:id', 'rId_headerfooter_vml1');
- $objWriter->endElement();
- }
- }
-}
diff --git a/admin/survey/excel/PHPExcel/Writer/Excel2007/WriterPart.php b/admin/survey/excel/PHPExcel/Writer/Excel2007/WriterPart.php deleted file mode 100644 index b5f91b6..0000000 --- a/admin/survey/excel/PHPExcel/Writer/Excel2007/WriterPart.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php
-/**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2012 PHPExcel
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
- * @version 1.7.8, 2012-10-12
- */
-
-
-/**
- * PHPExcel_Writer_Excel2007_WriterPart
- *
- * @category PHPExcel
- * @package PHPExcel_Writer_Excel2007
- * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
-abstract class PHPExcel_Writer_Excel2007_WriterPart
-{
- /**
- * Parent IWriter object
- *
- * @var PHPExcel_Writer_IWriter
- */
- private $_parentWriter;
-
- /**
- * Set parent IWriter object
- *
- * @param PHPExcel_Writer_IWriter $pWriter
- * @throws Exception
- */
- public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null) {
- $this->_parentWriter = $pWriter;
- }
-
- /**
- * Get parent IWriter object
- *
- * @return PHPExcel_Writer_IWriter
- * @throws Exception
- */
- public function getParentWriter() {
- if (!is_null($this->_parentWriter)) {
- return $this->_parentWriter;
- } else {
- throw new Exception("No parent PHPExcel_Writer_IWriter assigned.");
- }
- }
-
- /**
- * Set parent IWriter object
- *
- * @param PHPExcel_Writer_IWriter $pWriter
- * @throws Exception
- */
- public function __construct(PHPExcel_Writer_IWriter $pWriter = null) {
- if (!is_null($pWriter)) {
- $this->_parentWriter = $pWriter;
- }
- }
-
-}
|