API Documentation
Word content
Format conversion
CryptoPHPDOCX
Digital Signature package
addDOCX
Inserts an external Word document (.docx) into the current Word document.
PRO, PRO+ and CORPORATE PHPDocX >= 2.3
Description
public addDOCX ( array $options)
This method allows for the insertion of an external docx document within the current Word document.
It is recommended that the page layout of the inserted docx coincides with the one of te Word document we are generating with PHPDocX, if not you may expect certain formatting problems.
This method is not compatible with the conversion plugin: the inserted docx will not render at all in the resulting PDF, DOC, RTF, ODT or HTML document.
Parameters
options
An array with the available options.
The posible keys and values are (required options are shown with yellow background):
| key | Type | Description |
|---|---|---|
| pathDOCX | string | The path to the document (.docx) that we want to insert within our current Word document |
| rawWordML | bool | Returns the WordML raw code |
Return values
If the option rawWordML is set to true (default value is false) it returns a string with the raw WordML code, else returns nothing.
Code samples
Example #1: insert a docx file.
require_once 'classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addDOCX(array('pathDOCX' => '../files/Text.docx'));
$docx->createDocx('example_docx');
The resulting Word document looks like (download .docx file):
Change log
- Available since 2.3
- rawWordML option included in 3.0
Available examples
See also
PHPDocx. Dinamic generation of reports in .docx format 

