Hi
We recently bought corp verson expecting it to convert docx to html and also html to docx but now realised that it is one way conversion.
Is it possible to convert back to docx document from the html files genrated by plugin?
Thanks
Hi
We recently bought corp verson expecting it to convert docx to html and also html to docx but now realised that it is one way conversion.
Is it possible to convert back to docx document from the html files genrated by plugin?
Thanks
Hello,
You can do both tasks. To transform DOCX to HTML you need to use the conversion plugin and to transform HTML to DOCX you need to use embedHTML.
Regards. Jorge.
Thanks for reply.
I was able to convert to docx back but there are 2 smal issues.
Conversion si adding line extra breaks in formatting for some content. Another issue is that headers and footer don't get added back as header and footer but as image at top and bottom only.
I see that there is <DIV TYPE=HEADER> and <DIV TYPE=FOOTER> in html file generated.
Is it possible somehow to insert them as actual header and footer in docx when converting from html?
Thanks.
Hello,
As HTML doesn't have headers and footers like DOCX, you'll need to write the code to create the headers and footers of that HTML. You just need to use embedHTML to add HTML to DOCX to content, header or footer with 'target' option. Please check included phpdoc:
/**
* Embed HTML into the Word document by parsing the HTML code and converting it into WordML
* It preserves many CSS styles
*
* @access public
* @example ../examples/easy/EmbedSimpleHTML.php
* @example ../examples/intermediate/EmbedExternalHTML.php
* @example ../examples/intermediate/EmbedHTMLinTable.php
* @param string $html HTML to add. Must be a valid XHTML
* @param array $options:
* isFile (boolean),
* baseURL (string),
* downloadImages (boolean),
* filter (string) could be an string denoting the id, class or tag to be filtered.
* If you want only a class introduce .classname, #idName for an id or <htmlTag> for a particular tag. One can also use
* standard XPath expresions supported by PHP.
* 'parseAnchors' (boolean),
* 'parseDivs' (paragraph, table): parses divs as paragraphs or tables,
* 'parseFloats' (boolean),
* 'strictWordStyles' (boolean) if true ignores all CSS styles and uses the styles set via the wordStyles option (see next)
* 'wordStyles' (array) associates a particular class, id or HTML tag to a Word style
* 'target' (string) document (default value), defaultHeader, firstHeader, evenHeader, defaultFooter, firstFooter, evenFooter.
* 'rawWordML' (boolean)
*/
public function embedHTML($html = '<html><body></body></html>', $options = array())
Regards.