transformDocAdvHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createDocx
- createDocxAndDownload
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importChartStyle
- importHeadersAndFooters
- importListStyle
- importStyles
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- addBibliography
- addBookmark
- addBreak
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addOnlineVideo
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordFragment
- addWordML
- embedHTML
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
transformDocAdvHTML


Transforms documents into HTML using native PHP classes.
This method allows to transform a DOCX document, generated or not with phpdocx, 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.
htmlPlugin
Plugin used to transform the DOCX, TransformDocAdvHTMLDefaultPlugin as default.
options
The possible keys and values are:
Key | Type | Description |
---|---|---|
addDefaultStyles | bool | If true add default MS Word styles. Default as true. |
includeBlankSpacesInEmptyParagraphs | bool | If true add a blank space to empty paragraphs. Useful to keep blank paragraphs if needed. Default as false. |
includeContentTypes | array | If a content type is not set, its transformation is not done. Available content types: images, charts. Default all content types. |
javaScriptAtTop | bool | Adds the JavaScript at the top of the HTML. Default as false. |
numberingAsParagraphs | bool | If true add list numberings as paragraphs. Useful to transform complex numberings. Default as false. |
returnHTMLStructure | bool | If true returns an array with the structure of the DOCX transformed to HTML: (css, document, endnotes, footnotes, headers, footers, javascript. metas). Default as false. |
generateClassName
Function to generate class names.
setBaseCSS
Base CSS to be added when transforming the document.
Default value: '<style>p { margin-top: 0px;margin-bottom: 0px;} span.tabcontent{margin-left: 50px;} ins {color: red;} del {color: red;}</style>'.
setBaseHTML
Base HTML to be added when transforming the document.
Default value: '<!DOCTYPE html><html>'.
setBaseJavaScript
Base JavaScript to be added when transforming the document.
Default value: '<script src="https://cdn.plot.ly/plotly-2.14.0.min.js"></script>'.
setBaseMeta
Base meta tags to be added when transforming the document.
Default value: '<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.
Error while trying to open the (base) template as a zip file.
Example #1