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

example

  1. <?php
  2.  
  3. /**
  4.  * Template table example.
  5.  *
  6.  * @category   Phpdocx
  7.  * @package    examples
  8.  * @subpackage intermediate
  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. $settings array(
  21.     'header' => true
  22. );
  23.  
  24. $docx->addTemplate('../files/TemplateTable.docx');
  25.  
  26.     array(
  27.         array(
  28.             'NAME' => 'Product A',
  29.             'WEIGHT' => '10',
  30.             'PRICE' => '5',
  31.         ),
  32.         array(
  33.             'NAME' => 'Product B',
  34.             'WEIGHT' => '20',
  35.             'PRICE' => '30',
  36.         ),
  37.         array(
  38.             'NAME' => 'Product C',
  39.             'WEIGHT' => '25',
  40.             'PRICE' => '7',
  41.         ),
  42.         array(
  43.             'NAME' => 'Product D',
  44.             'WEIGHT' => '25',
  45.             'PRICE' => '7',
  46.         )
  47.     ),
  48.     'table',
  49.     $settings
  50. );
  51.  
  52. $docx->addTemplateVariable('TOTALWEIGHT''55');
  53.  
  54. $docx->addTemplateVariable('TOTALPRICE''42');
  55.  
  56. $docx->addTemplateVariable('MYNAME''David Hume');
  57.  
  58. $docx->createDocx('../docx/example_template');

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