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

example

  1. <?php
  2.  
  3. /**
  4.  * Embed some HTML as part of a table.
  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      2012.12.26
  15.  */
  16. require_once '../../classes/CreateDocx.inc';
  17.  
  18. $docxnew CreateDocx();
  19.  
  20. $html'<p style="border: 2px solid black; color: red">A short text with a red border.</p>';
  21. $html'<p>And now we draw a table with border and rawspans and colspans:</p>';
  22. $html.= '<table border="1">';
  23. $html.= '<tbody><tr><td style="background-color: yellow">1_1</td><td rowspan="3" colspan="2">1_2</td></tr>';
  24. $html.='<tr><td>Some random text.</td></tr>';
  25. $html.='<tr><td><ul><li>One</li><li>Two <b>and a half</b></li></ul></td></tr>';
  26. $html.='<tr><td>3_2</td><td>3_3</td><td>3_3</td></tr></tbody>';
  27. $html.= '</table>';
  28.  
  29. $html '<p>hello</p>';
  30.  
  31. $myHTML $docx->embedHTML('http://www.2mdc.com/PHPDOCX/example.html'array('isFile' => true'parseDivsAsPs' => true,  'id' => 'capa_bg_bottom''downloadImages' => true'rawWordML' => true));
  32.  
  33. $fragment $docx->createWordMLFragment(array($myHTML));
  34.  
  35. $valuesTable array(
  36.     array(
  37.         11,
  38.         12
  39.     ),
  40.     array(
  41.         $fragment,
  42.         22
  43.     ),
  44. );
  45.  
  46. $paramsTable array(
  47.     'border' => 'single',
  48.     'border_sz' => 20,
  49.     'rawWordML' => true
  50. );
  51.  
  52. $test $docx->addTable($valuesTable$paramsTable);
  53.  
  54. $fragment2 $docx->createWordMLFragment($test);
  55.  
  56. $valuesTable2 array(
  57.     array(
  58.         11,
  59.         12
  60.     ),
  61.     array(
  62.         $fragment2,
  63.         22
  64.     ),
  65. );
  66.  
  67. $paramsTable2 array(
  68.     'border' => 'single',
  69.     'border_sz' => 20,
  70.     'rawWordML' => false
  71. );
  72.  
  73. $docx->addTable($valuesTable2$paramsTable2);
  74.  
  75. $docx->addList(array('uno'$fragment'tres')array('val' => 1));
  76.  
  77. $docx->createDocx('../docx/example_embedHTMLinTable');

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