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

example

  1. <?php
  2.  
  3. /**
  4.  * Creates a table with embeded elements: links and images.
  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. $paramsLink array(
  21.     'title' => 'Link to Google',
  22.     'link' => 'http://www.google.es'
  23. );
  24.  
  25. $link $docx->addElement('addLink'$paramsLink);
  26.  
  27. $paramsImg array(
  28.     'name' => '../files/img/image.png'
  29. );
  30.  
  31. $image $docx->addElement('addImage'$paramsImg);
  32.  
  33. $valuesTable array(
  34.     array(
  35.         'Title A',
  36.         'Title B',
  37.         'Title C',
  38.     ),
  39.     array(
  40.         'Line A',
  41.         $link,
  42.         $image,
  43.     )
  44. );
  45.  
  46. $paramsTable array(
  47.     'TBLSTYLEval' => 'MediumShading1PHPDOCX',
  48.     'border' => 'single',
  49.     'border_sz' => 20,
  50.     'border_spacing' => 0,
  51.     'border_color' => 'ff0000',
  52.     'jc' => 'center',
  53.     'size_col' => 1200
  54. );
  55.  
  56. $docx->addTable($valuesTable$paramsTable);
  57. $docx->createDocx('../docx/example_table');

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