News

Adding HTML to a docx document created with PHPdocx

  • Jun 06, 2011

This information is outdated, please, refer to the HTML to Word documentation for up to date info.
Add HTML to a docx document with PHPDocX is easy.
In this example you can see how to add some HTML and the format of it. Here is the code:


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

$docx = new CreateDocx();

$html = '

Dynamic DOCX generation. New 2.2 version
with support for OpenOffice Documents, rewritten and faster API
and new features!
Do you need to dynamically generate Word documents?.
PHPDOCX do this and much more. You may create highly customized reports in Word extracting data directly from any database or spreadsheet. These reports may include editable graphs, images, tables, headers, footers, etcetera. PHPDOCX  can create Word documents from scratch or use predefined templates to simplify your work. With a few lines of code you may integrate PHPDOCX in your website or intranet and offer a valuable service to your customers and employees..



DOWNLOAD NOW
Do you need this functionality with Java ? Try JavadocX!

100% compatibility

';

$docx->addHTML($html);

$html = '

What is PHPDOCX ?
PHPDOCX is a PHP library designed to generate completely dynamic and fully customizable Word documents.
PHPDOCX is hosted in your server providing a very and complete flexible solution for your document and report generation needs.
What can I do with PHPDOCX ?

With a few lines of code you can generate a complete report that includes:

Editable Text
Images and Graphic elements
Standard paragraphs
Bulleted or numbered lists
Customized tables

Dynamic tables
All kind of customizable and editable charts or graphs to display numerical data
Tables of content to simplify readability within long documents
Headers that will reflect your corporate branding
Footers with automatic page numbering


You could also create and use your own templates for Mailmerge or to generate really sophisticated reports and documents.
Latest Blog entries
';

$docx->addHTML($html);

$docx->createDocx('example_html');