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

example

  1. <?php
  2.  
  3. /**
  4.  * Creates a table with embeded styles.
  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 2.2
  15.  */
  16. require_once '../../classes/CreateDocx.inc';
  17.  
  18. $docx new CreateDocx();
  19.  
  20. $frameworks array(
  21.                 array('name' => 'Code Igniter',
  22.                     'ajax' => 'Prototype/script.aculo.us, jQuery/jQuery UI',
  23.                     'mvc' => 'Modified active record pattern',
  24.                     'orm' => 'No',
  25.                     'security' => 'Yes'
  26.                 ),
  27.                 array('name' => 'Drupal',
  28.                     'ajax' => 'jQuery/jQuery UI, more',
  29.                     'mvc' => 'No',
  30.                     'orm' => 'Optional module',
  31.                     'security' => 'Yes'
  32.                 ),
  33.                 array('name' => 'eZ Components',
  34.                     'ajax' => 'No',
  35.                     'mvc' => 'Yes',
  36.                     'orm' => 'Yes',
  37.                     'security' => 'Yes'
  38.                 ),
  39.                 array('name' => 'Symfony',
  40.                     'ajax' => 'Prototype, script.aculo.us, Unobtrusive Ajax ' .
  41.                             'with UJS and PJS plugins',
  42.                     'mvc' => 'Push',
  43.                     'orm' => 'Yes',
  44.                     'security' => 'Plugin'
  45.                 ),
  46.                 array('name' => 'Zend Framework',
  47.                     'ajax' => 'Toolkit-independent',
  48.                     'mvc' => 'Push and Pull',
  49.                     'orm' => 'Yes',
  50.                     'security' => 'ACL-based'
  51.                 )
  52. );
  53.  
  54. $headerStyle[0array(
  55.     'b' => 'single',
  56.     'font' => 'Arial',
  57. );
  58.  
  59. $table[array(
  60.     '',
  61.     'Ajax',
  62.     'MVC framework',
  63.     'ORM',
  64.     'Security Framework(s)'
  65. );
  66.  
  67. foreach ($frameworks as $framework{
  68.     $headerStyle[0]['text'$framework['name'];
  69.     $table[array(
  70.         $docx->addElement('addText'$headerStyle),
  71.         $framework['ajax'],
  72.         $framework['mvc'],
  73.         $framework['orm'],
  74.         $framework['security']
  75.     );
  76. }
  77.     
  78. $paramsTable array(
  79.     'TBLSTYLEval' => 'MediumShading1PHPDOCX',
  80.     'border' => 'single',
  81.     'border_sz' => 20,
  82.     'border_spacing' => 0,
  83.     'border_color' => '000000',
  84.     'jc' => 'center',
  85.     'size_col' => 2800
  86. );
  87.  
  88. $docx->addTable($table$paramsTable);
  89.  
  90. $docx->createDocx('../docx/example_table_styled');

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