transformDocAdvHTML

transformDocAdvHTML

ADVANCED / PREMIUM BASIC

Transforms documents into HTML using native PHP classes.

Description
public transform (TransformDocAdvHTMLPlugin $htmlPlugin, [, array $options])

This method allows to transform a DOCX document, generated or not with Javadocx, into HTML preserving, as much as possible, the original formatting options.

Tags, CSS, sizes and other transformations can be customized easily extending the classes and using plugins.

You may find more info regarding this method in the Word to HTML section.

Parameters transform

htmlPlugin

Plugin used to transform the DOCX, TransformDocAdvHTMLDefaultPlugin as default.

options

The possible keys and values are:

Key Type Description
javaScriptAtTop bool False by default. Adds the JavaScript at the bottom of the HTML.
returnHTMLStructure bool False by default. If true returns an array with the structure of the DOCX transformed to HTML: (css, document, endnotes, footnotes, headers, footers, javascript. metas).
Methods and attributes TransformDocAdvHTMLPlugin

generateClassName

Function to generate class names.

setBaseCSS

Base CSS to be added when transforming the document. Default as empty.

setBaseHTML

Base HTML to be added when transforming the document. Default as '<!DOCTYPE html><html>'

setBaseJavaScript

Base JavaScript to be added when transforming the document. Default as empty.

setBaseMeta

Base meta tags to be added when transforming the document. Default as '<meta charset="UTF-8">'

setConversionFactor

Conversion factor to transform sizes. Default as 1.3

setExtraClasses

Extra classes to add for a tag.

setGenerateSectionTags

Default as true. If false, the transformation doesn't read section tags.

setImagesAsBase64

Default as true. If false, it generates the images as files.

setOutputFilesPath

Set the output path folder of the external files (altchunk, images...). If setImagesAsBase64 is set as true, the images aren't saved to this folder.

setTag

Set a specific tag for a OOXML tag.

transformColors

Function to transform color values.

transformSizes

Function to transform size values.

Code samples

Example #1