Permalink
Browse files

Work item 5580 - Editing chart data

git-svn-id: https://phppowerpoint.svn.codeplex.com/svn/trunk@55461 ffd33b8c-2492-42e0-bdc5-587b920b7d6d
  • Loading branch information...
1 parent 771086e commit de13dacb124b91b35c01dec8b9b2fc0c55162a6c @maartenba maartenba committed Dec 28, 2010
@@ -62,6 +62,13 @@ class PHPPowerPoint_Shape_Chart extends PHPPowerPoint_Shape_BaseDrawing implemen
* @var PHPPowerPoint_Shape_Chart_View3D
*/
private $_view3D;
+
+ /**
+ * Include spreadsheet for editing data? Requires PHPExcel in the same folder as PHPPowerPoint
+ *
+ * @var bool
+ */
+ private $_includeSpreadsheet = false;
/**
* Create a new PHPPowerPoint_Slide_MemoryDrawing
@@ -113,6 +120,26 @@ public function getPlotArea() {
public function getView3D() {
return $this->_view3D;
}
+
+ /**
+ * Include spreadsheet for editing data? Requires PHPExcel in the same folder as PHPPowerPoint
+ *
+ * @return boolean
+ */
+ public function getIncludeSpreadsheet() {
+ return $this->_includeSpreadsheet;
+ }
+
+ /**
+ * Include spreadsheet for editing data? Requires PHPExcel in the same folder as PHPPowerPoint
+ *
+ * @param boolean $value
+ * @return PHPPowerPoint_Shape_Chart
+ */
+ public function setIncludeSpreadsheet($value = false) {
+ $this->_includeSpreadsheet = $value;
+ return $this;
+ }
/**
* Get indexed filename (using image index)
@@ -135,6 +162,7 @@ public function getHashCode() {
. $this->_legend->getHashCode()
. $this->_plotArea->getHashCode()
. $this->_view3D->getHashCode()
+ . ($this->_includeSpreadsheet ? 1 : 0)
. __CLASS__
);
}
@@ -262,6 +262,12 @@ public function save($pFilename = null)
$objZip->addFromString('ppt/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents);
} else if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPPowerPoint_Shape_Chart) {
$objZip->addFromString('ppt/charts/' . $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename(), $this->getWriterPart('Chart')->writeChart($this->getDrawingHashTable()->getByIndex($i)));
+
+ // Chart relations?
+ if ($this->getDrawingHashTable()->getByIndex($i)->getIncludeSpreadsheet()) {
+ $objZip->addFromString('ppt/charts/_rels/' . $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename() . '.rels', $this->getWriterPart('Rels')->writeChartRelationships($this->getDrawingHashTable()->getByIndex($i)));
+ $objZip->addFromString('ppt/embeddings/' . $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename() . '.xlsx', $this->getWriterPart('Chart')->writeSpreadsheet($this->_presentation, $this->getDrawingHashTable()->getByIndex($i), $pFilename . '.xlsx'));
+ }
}
}
Oops, something went wrong.

0 comments on commit de13dac

Please sign in to comment.