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

example

  1. <?php
  2.  
  3. /**
  4.  * Insert an image into 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    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. $paramsImg array(
  21.     'name' => '../files/img/image.png',
  22.     'scaling' => 50,
  23.     'spacingTop' => 100,
  24.     'spacingBottom' => 100,
  25.     'spacingLeft' => 100,
  26.     'spacingRight' => 100,
  27.     'textWrap' => 1,
  28.     'border' => 1,
  29.     'borderDiscontinuous' => 1
  30. );
  31.  
  32. $docx->addImage($paramsImg);
  33.  
  34. $docx->addText('Now we are going to insert twice the same image in a table cell:');
  35.  
  36. $paramsImg array(
  37.     'name' => '../files/img/image.png',
  38.     'scaling' => 50,
  39.     'spacingTop' => 10,
  40.     'spacingBottom' => 10,
  41.     'spacingLeft' => 100,
  42.     'spacingRight' => 0,
  43.     'textWrap' => 1,
  44.     'border' => 1,
  45.     'borderDiscontinuous' => 1,
  46.     'rawWordML' => true
  47. );
  48.  
  49. $imageData $docx->addImage($paramsImg);
  50.  
  51. $fragment $docx->createWordMLFragment(array($imageData$imageData));
  52.  
  53. $valuesTable array(
  54.     array(
  55.         11,
  56.         12
  57.     ),
  58.     array(
  59.         $fragment,
  60.         22
  61.     ),
  62. );
  63.  
  64. $paramsTable array(
  65.     'border' => 'single',
  66.     'border_sz' => 5,
  67. );
  68.  
  69. $test $docx->addTable($valuesTable$paramsTable);
  70.  
  71. $docx->createDocx('../docx/example_image');

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