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

example

  1. <?php
  2.  
  3. /**
  4.  * Inserts a simple text in bold Arial font.
  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.  
  17. require_once '../../classes/CreateDocx.inc';
  18.  
  19. $docx new CreateDocx();
  20.  
  21. $text 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' .
  22.     'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut ' .
  23.     'enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut' .
  24.     'aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit ' .
  25.     'in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ' .
  26.     'Excepteur sint occaecat cupidatat non proident, sunt in culpa qui ' .
  27.     'officia deserunt mollit anim id est laborum.';
  28.  
  29. $paramsText array(
  30.     'b' => 'on',
  31.     'font' => 'Arial'
  32. );
  33.  
  34. $docx->addText($text$paramsText);
  35.  
  36. $docx->addText('Now we are going to insert the text in two different table cells:');
  37.  
  38. $paramsText array(
  39.     'font' => 'Arial',
  40.     'rawWordML' => true
  41.     
  42. );
  43.  
  44. $textData $docx->addText($text$paramsText);
  45.  
  46. $fragment $docx->createWordMLFragment($textData);
  47.  
  48. $valuesTable array(
  49.     array(
  50.         11,
  51.         $fragment
  52.     ),
  53.     array(
  54.         $fragment,
  55.         22
  56.     ),
  57. );
  58.  
  59. $paramsTable array(
  60.     'border' => 'single',
  61.     'border_sz' => 5,
  62. );
  63.  
  64. $test $docx->addTable($valuesTable$paramsTable);
  65.  
  66. $docx->createDocx('../docx/example_text');

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