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

example

  1. <?php
  2.  
  3. /**
  4.  * Inserts a simple table into the 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. $valuesTable array(
  21.     array(
  22.         11,
  23.         12
  24.     ),
  25.     array(
  26.         21,
  27.         22
  28.     ),
  29. );
  30.  
  31. $paramsTable array(
  32.     'border' => 'single',
  33.     'border_sz' => 20
  34. );
  35.  
  36.  
  37. $docx->addTable($valuesTable$paramsTable);
  38.  
  39. $docx->addText('Now we are going to insert table within tables:');
  40.  
  41. $valuesTable array(
  42.     array(
  43.         a,
  44.         b
  45.     ),
  46.     array(
  47.         c,
  48.         d
  49.     ),
  50. );
  51.  
  52. $paramsTable array(
  53.     'border' => 'single',
  54.     'border_sz' => 5,
  55.     'rawWordML' => true
  56. );
  57.  
  58.  
  59. $docx->addTable($valuesTable$paramsTable);
  60.  
  61. $TABLEdata $docx->addTable($valuesTable$paramsTable);;
  62.  
  63. $fragment $docx->createWordMLFragment($TABLEdata);
  64.  
  65. $valuesTable array(
  66.     array(
  67.         11,
  68.         $fragment
  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_table');

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