create
[ class tree: create ] [ index: create ] [ all elements ]

example

  1. <?php
  2.  
  3. /**
  4.  * Insert a 3D pie chart into a Word document.
  5.  *
  6.  * @category   Phpdocx
  7.  * @package    examples
  8.  * @subpackage easy
  9.  * @copyright  Copyright (c) 2009-2013 Narcea Producciones Multimedia S.L.
  10.  *              (http://www.2mdc.com)
  11.  * @license    http://www.phpdocx.com/wp-content/themes/lightword/pro_license.php
  12.  * @version    2012.12.26
  13.  * @link       http://www.phpdocx.com
  14.  * @since      File available since Release 1.8
  15.  */
  16. require_once '../../classes/CreateDocx.inc';
  17.  
  18. $docx new CreateDocx();
  19.  
  20. $legends array(
  21.     'legend1' => array(10),
  22.     'legend2' => array(20),
  23.     'legend3' => array(40)
  24. );
  25.  
  26. $paramsChart array(
  27.     'data' => $legends,
  28.     'type' => 'pie3DChart',
  29.     'title' => 'Title',
  30.     'rotX' => 20
  31.     'rotY' => 20,
  32.     'perspective' => 30,
  33.     'color' => 2,
  34.     'textWrap' => 0,
  35.     'sizeX' => 10,
  36.     'sizeY' => 10,
  37.     'jc' => 'right',
  38.     'showPercent' => 1,
  39.     'font' => 'Times New Roman'
  40. );
  41. $docx->addChart($paramsChart);
  42.  
  43. $docx->addText('Now we are going to insert the same chart in a table cell:');
  44.  
  45. $paramsChart array(
  46.     'data' => $legends,
  47.     'type' => 'pie3DChart',
  48.     'title' => 'Title',
  49.     'rotX' => 20
  50.     'rotY' => 20,
  51.     'perspective' => 30,
  52.     'color' => 2,
  53.     'textWrap' => 0,
  54.     'sizeX' => 10,
  55.     'sizeY' => 10,
  56.     'showPercent' => 1,
  57.     'font' => 'Times New Roman',
  58.     'rawWordML' => true
  59. );
  60.  
  61. $CHARTdata $docx->addChart($paramsChart);
  62.  
  63. $fragment $docx->createWordMLFragment(array($CHARTdata));
  64.  
  65. $valuesTable array(
  66.     array(
  67.         11,
  68.         12
  69.     ),
  70.     array(
  71.         $fragment,
  72.         22
  73.     ),
  74. );
  75.  
  76. $paramsTable array(
  77.     'border' => 'single',
  78.     'border_sz' => 5,
  79. );
  80.  
  81. $test $docx->addTable($valuesTable$paramsTable);
  82.  
  83. $docx->createDocx('../docx/example_chart');

Documentation generated on Mon, 13 Jan 2014 13:44:07 +0100 by phpDocumentor 1.4.4