Forum


Replies: 4   Views: 4706
Coversion back to docx from html file generated by plugin conversion
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by jorgelj  · 04-07-2013 - 12:23

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.