<td>cell_1_3</td>
	  <td>cell_1_4</td>
  </tr>
  <tr>
	  <td>cell_2_3</td>
	  <td>cell_2_4</td>
  </tr>
  <tr>
	  <td>cell_3_1</td>
	  <td>cell_3_2</td>
	  <td>cell_3_3</td>
	  <td>cell_3_4</td>
  </tr>
</table>';
$docx->embedHTML($myHTML, array('tableStyle' => 'MediumGrid3-accent5PHPDOCX'));
$docx->addBreak();
$text = 'We are going to locate three pictures in a row just below this text. And we are going to use Trebuchet MS font to change a little bit :-)';
$paramsText = array('font' => 'Trebuchet MS');
$docx->addText($text, $paramsText);
$images = array('../img/image.png', '../img/image.png', '../img/image.png');
$wordImages = array();
foreach ($images as $image) {
    $paramsImg = array('name' => $image, 'dpi' => 120, 'scaling' => 90, 'spacingTop' => 10, 'spacingBottom' => 10, 'spacingLeft' => 10, 'spacingRight' => 10, 'textWrap' => 1);
    array_push($wordImages, $docx->addElement('addImage', $paramsImg));
}
$paramsTable = array('TBLSTYLEval' => 'NormalTablePHPDOCX');
$valuesTable = array($wordImages);
$docx->addTable($valuesTable, $paramsTable);
$legends = array('legend' => array('sequence 1', 'sequence 2', 'sequence 3'), 'Category 1' => array(9.300000000000001, 2.4, 2), 'Category 2' => array(8.5, 4.4, 1), 'Category 3' => array(6.5, 1.8, 0.5), 'Category 4' => array(8.5, 3, 1), 'Category 5' => array(6, 5, 2.6));
$args = array('data' => $legends, 'type' => 'colBar', 'title' => 'Chart with table', 'sizeX' => 15, 'sizeY' => 15, 'legendPos' => 't', 'border' => 1, 'vgrid' => 1, 'showtable' => 1);
$docx->addChart($args);
<?php

/**
 * Create a DOCX file. Page break example
 *
 * @category   Phpdocx
 * @package    examples
 * @subpackage easy
 * @copyright  Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
 *             (http://www.2mdc.com)
 * @license    LGPL
 * @version    2.0
 * @link       http://www.phpdocx.com
 * @since      File available since Release 2.0
 */
require_once '../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$text = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' . 'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut ' . 'enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut' . 'aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit ' . 'in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ' . 'Excepteur sint occaecat cupidatat non proident, sunt in culpa qui ' . 'officia deserunt mollit anim id est laborum.';
$docx->addText($text);
$docx->addBreak('line');
$docx->addText($text);
$docx->addBreak('line');
$docx->addBreak('line');
$docx->addText($text);
$docx->addBreak('page');
$docx->addText($text);
$docx->createDocx('example_pagebreak');
Пример #3
0
<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$text = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' . 'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut ' . 'enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut' . 'aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit ' . 'in voluptate velit esse cillum dolore eu fugiat nulla pariatur.';
$docx->addText($text);
$docx->addText($text);
$docx->addBreak(array('type' => 'line'));
$docx->addText($text);
$docx->addBreak(array('type' => 'line', 'number' => 2));
$docx->addText($text);
$docx->addBreak(array('type' => 'page'));
$docx->addText($text);
$docx->createDocx('example_addBreak_1');
Пример #4
0
<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$options = array('src' => '../../img/image.png', 'scaling' => 40, 'spacingTop' => 0, 'spacingBottom' => 0, 'spacingLeft' => 0, 'spacingRight' => 20, 'textWrap' => 1);
$docx->addImage($options);
$text = 'There is more than one way to make that the text wraps around an image. ';
$text .= 'Maybe the simplest is the one used here with the option textWrap = 1. ';
$text .= 'You may also placed it on the right using the float option.';
$docx->addText($text);
$docx->addBreak(array('type' => 'line'));
$text = 'Although you can have a little more control using Word fragments. ';
$text .= 'This si so because in the first example the image is in a paragraph of its own ';
$text .= 'while here it is inserted in the same paragraph as this text.';
$image = new WordFragment($docx);
$options = array('src' => '../../img/image.png', 'scaling' => 40, 'spacingTop' => 0, 'spacingBottom' => 0, 'spacingLeft' => 20, 'spacingRight' => 0, 'textWrap' => 1, 'float' => right);
$image->addImage($options);
$runs = array();
$runs[] = $image;
$runs[] = array('text' => $text);
$docx->addText($runs);
$docx->createDocx('example_addImage_2');
Пример #5
-1
<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//create a Word fragment to insdert in the default header
$numbering = new WordFragment($docx, 'defaultHeader');
//sert some formatting options
$options = array('textAlign' => 'right', 'bold' => true, 'sz' => 14, 'color' => 'B70000');
$numbering->addPageNumber('numerical', $options);
$docx->addHeader(array('default' => $numbering));
//Now we include a couple of pages to better illustrate the example
$docx->addText('This is the first page.');
$docx->addBreak(array('type' => 'page'));
$docx->addText('This is the second page.');
$docx->addBreak(array('type' => 'page'));
$docx->addText('This is the third page.');
$docx->createDocx('example_addPageNumber_1');