Convert your Office documents to HTML5 + CSS

Since v3 Docxpresso offers you the possibility to convert your Office text documents into W3C compliant HTML5 + CSS.

The conversion into HTML not only preserve format but also converts charts into browser friendly charts (with the help of the C3 and D3 JS libraries),
math formulas into MathJax, SmartArt into SVG shapes and document comments into popable info ballons (with the help of the webui-popover JS library) among other multiple options.

The ODF2HTML5 subpackage has support for:

  • Nicely formatted text
  • Headings (numbered)
  • Tables
  • Links and bookmarks
  • Nested lists with sophisticated numberings
  • Images
  • Textboxes
  • Footnotes and endnotes
  • Headers and Footers
  • Tables of contents (TOCs)
  • Charts
  • Comments
  • Math equations
  • Drop caps
  • Office SmartArt and forms (partial)
  • Support for Right-To-Left languages
  • And much more…

Its public API is given by:


public ODF2HTML5 ($path [,$options])


  • $path (type: string). The path to the resulting HTML5 file. The path should include the extension (html or htm)
  • $options (type: array).
    This (optional) array has the following available keys and values:

    • charts (type: boolean). If true renders the chart via JavaScript. The default value is true.
    • css (type: string). Path to an external CSS stylesheet.
    • download (type: boolean). if true saves the file and returns a string that can be echoed to the browser. Default is false.
    • format (type: string). The values can be:
      • standard: (default) the styles and images are stored in a folder with the same name of the HTML5 file.
      • single-file: the styles are integrated within the <head> tag element and the images are base64 encoded an integrated within the HTML5 file.
    • meta (type: mixed). It can be boolean value: if true the metadata will be extracted automatically from the document and if false (default) no metadata will be included, or an array with key-value pairs the property name and its corresponding value.
    • parseLayout (type: boolean). If true (default) parses the document layout otherwise ignores it.
    • SVG (type: boolean). If true renders the drawings as SVG. The default value is false.
    • loadJQuery (type: boolean). If true makes a call to the JQuery JS library (the required version may be set in the config.ini file). The default value is false.

This simple script converts an .odt file to HTML5 + CSS and flushes it into the browser:

 * This sample script converts a .odt file into HTML + CSS + JS
require_once 'pathToDOCXPRESSO/';
$doc = new DocxpressocreateDocument(array('template' => 'test.odt'));
$html = $doc->ODF2HTML5('test.html', array('metadata' => true, 'format' => 'single-file', 'download' => true, 'parseLayout' => true));
echo $html;