News

Insert a RTF into a docx document using PHPDocX

  • Jun 03, 2011

This information is outdated, please, refer to the addRTF documentation for up to date info.
In the same way that we can insert a docx document into another docx document, we can also insert a RTF document.
The Rich Text Format (often abbreviated RTF) is a proprietary document file format with published specification developed by Microsoft Corporation for cross-platform document interchange.
To add a RTF is simple:


require_once '../../classes/CreateDocx.inc';

$docx = new CreateDocx();

// Open import of an RTF document
$docx->addText('RTF content');
// Route to the document
$docx->addRTF('../files/Text.rtf');
// Close import of the document
$docx->addText('End RTF content');

$docx->createDocx('example_rtf');