fix formatting
This commit is contained in:
parent
214df1a1cb
commit
1168789e8a
|
|
@ -250,8 +250,19 @@ See ``Sample_40_TemplateSetComplexValue.php`` for examples.
|
||||||
$table->addCell(150)->addText('Cell B3');
|
$table->addCell(150)->addText('Cell B3');
|
||||||
$templateProcessor->setComplexBlock('table', $table);
|
$templateProcessor->setComplexBlock('table', $table);
|
||||||
|
|
||||||
|
setChartValue
|
||||||
|
"""""""""""""
|
||||||
|
Replace a variable by a chart.
|
||||||
|
|
||||||
|
.. code-block:: php
|
||||||
|
|
||||||
|
$categories = array('A', 'B', 'C', 'D', 'E');
|
||||||
|
$series1 = array(1, 3, 2, 5, 4);
|
||||||
|
$chart = new Chart('doughnut', $categories, $series1);
|
||||||
|
$templateProcessor->setChartValue('myChart', $chart);
|
||||||
|
|
||||||
save
|
save
|
||||||
"""""""""
|
""""
|
||||||
Saves the loaded template within the current directory. Returns the file path.
|
Saves the loaded template within the current directory. Returns the file path.
|
||||||
|
|
||||||
.. code-block:: php
|
.. code-block:: php
|
||||||
|
|
@ -259,7 +270,7 @@ Saves the loaded template within the current directory. Returns the file path.
|
||||||
$filepath = $templateProcessor->save();
|
$filepath = $templateProcessor->save();
|
||||||
|
|
||||||
saveAs
|
saveAs
|
||||||
"""""""""
|
""""""
|
||||||
Saves a copy of the loaded template in the indicated path.
|
Saves a copy of the loaded template in the indicated path.
|
||||||
|
|
||||||
.. code-block:: php
|
.. code-block:: php
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ $series1 = array(1, 3, 2, 5, 4);
|
||||||
$series2 = array(3, 1, 7, 2, 6);
|
$series2 = array(3, 1, 7, 2, 6);
|
||||||
$series3 = array(8, 3, 2, 5, 4);
|
$series3 = array(8, 3, 2, 5, 4);
|
||||||
|
|
||||||
$i=0;
|
$i = 0;
|
||||||
foreach ($chartTypes as $chartType) {
|
foreach ($chartTypes as $chartType) {
|
||||||
$chart = new Chart($chartType, $categories, $series1);
|
$chart = new Chart($chartType, $categories, $series1);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -365,7 +365,7 @@ class TemplateProcessor
|
||||||
$objectClass = 'PhpOffice\\PhpWord\\Writer\\Word2007\\Element\\' . $elementName;
|
$objectClass = 'PhpOffice\\PhpWord\\Writer\\Word2007\\Element\\' . $elementName;
|
||||||
|
|
||||||
// Get the next relation id
|
// Get the next relation id
|
||||||
$rId= $this->getNextRelationsIndex($this->getMainPartName());
|
$rId = $this->getNextRelationsIndex($this->getMainPartName());
|
||||||
$chart->setRelationId($rId);
|
$chart->setRelationId($rId);
|
||||||
|
|
||||||
// Define the chart filename
|
// Define the chart filename
|
||||||
|
|
|
||||||
|
|
@ -267,10 +267,10 @@ class Chart extends AbstractPart
|
||||||
$this->writeSeriesItem($xmlWriter, 'val', $values);
|
$this->writeSeriesItem($xmlWriter, 'val', $values);
|
||||||
|
|
||||||
// check that there are colors
|
// check that there are colors
|
||||||
if (is_array($colors) && count($colors)>0) {
|
if (is_array($colors) && count($colors) > 0) {
|
||||||
// assign a color to each value
|
// assign a color to each value
|
||||||
$valueIndex=0;
|
$valueIndex = 0;
|
||||||
foreach ($values as $value) {
|
for ($i = 1; $i < count($values); $i++) {
|
||||||
// check that there are still enought colors
|
// check that there are still enought colors
|
||||||
$xmlWriter->startElement('c:dPt');
|
$xmlWriter->startElement('c:dPt');
|
||||||
$xmlWriter->writeElementBlock('c:idx', 'val', $valueIndex);
|
$xmlWriter->writeElementBlock('c:idx', 'val', $valueIndex);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue