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

example

  1. <?php
  2.  
  3. /**
  4.  * Creates a custom list and inserts it in a 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    2013.09.07
  13.  * @link       http://www.phpdocx.com
  14.  * @since      File available since Release 3.4
  15.  */
  16. require_once '../../classes/CreateDocx.inc';
  17.  
  18. $docx new CreateDocx();
  19.  
  20. $listOptions array();
  21. $listOptions[0]['type''decimal';
  22. $listOptions[0]['format''[%1.]';
  23. $listOptions[1]['type''lowerLetter';
  24. $listOptions[1]['format''[%1.%2.]';
  25. $listOptions[1]['hanging'540;
  26.  
  27. $docx->createListStyle('new'$listOptions);
  28.  
  29. $itemList array(
  30.     'Line 1',
  31.     'Line 2',
  32.     array('subitem_1''subitem_2'),
  33.     'Line 4',
  34.     'Line 5'
  35. );
  36.  
  37. $options array(
  38.     'val' => 'new'
  39. );
  40. $docx->addText('Notice that the following list has a custom numbering style:');
  41. $docx->addList($itemList$options);
  42. $docx->addText('Now the same list but with standard numbering:');
  43. $docx->addList($itemListarray('val' => 2));
  44. $html '<ol class="new"><li>One</li><li>Two<ol class="old"><li>Two - One</li><li>Two - Two</li></ol></li></ol><p>New line.</p>';
  45. $html .= '<ol class="new"><li>One</li><li>Two<ol class="old"><li>Two - One</li><li>Two - Two</li></ol></li></ol><p>New line.</p>';
  46. $docx->addText('And now we insert the HTML lists.');
  47. $docx->embedHTML($htmlarray('customListStyles' => true));
  48. $docx->addText('And once again the same HTML list:');
  49. $docx->embedHTML($htmlarray('customListStyles' => true));
  50. $docx->addText('And once again the same HTML list but without custom stiles:');
  51. $docx->embedHTML($html);
  52. $docx->createDocx('../docx/example_liststyle');

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