Re: xhtml document to docx with "standard" word paragraph tags

Hussein Shafie <[email protected]> Wed, 6 Jun 2018 09:58:29 +0200
Newsgroups gmane.editors.xxe.general,gmane.text.xml.xfc.general
Message-ID <[email protected]>
On 06/05/2018 09:23 PM, Thomas wrote:
>
> I am looking for a way to convert a xhtml document to docx. I tried
> pandoc and of course xmlmind.
>
> Pandoc cannot deal with colspan and rowspan as the internal document
> model cannot deal with them.
>
> XML Mind gives a good result,

In XMLmind XML Editor, the conversion of XHTML (or DITA or DocBook) to 
DOCX is achieved by the means of the "XMLmind FO Converter XSL-FO 
processor plug-in" add-on. See 
http://www.xmlmind.com/xmleditor/addons_doc.html#xfc_foprocessor

This add-on includes a copy of another XMLmind product called "XMLmind 
XSL-FO Converter". See http://www.xmlmind.com/foconverter/




> but the resulting docx does not contain
> the classical paragraph formats, heading 1 ...heading 6, ...

Our XSLT stylesheets converting XHTML to XSL-FO (and then XSL-FO to DOCX 
by the means of "XMLmind XSL-FO Converter"; see above) do not generate 
any named MS-Word style, including standard ones like "Heading 1", 
"Heading 2", etc.

However it's possible to mark the MS-Word paragraphs generated for XHTML 
<h1>, <h2>, etc, as having an outline level. By doing this, these 
paragraphs will appear in the TOC generated by MS-Word.

This is done by passing this XSLT stylesheet parameter

set-outline-level = yes

(see 
http://www.xmlmind.com/xmleditor/_distrib/doc/xhtml/xslt_params.html#set-outline-level)

before using "XHTML|Convert Document|Convert to DOCX". See "Simplest 
customization" in 
http://www.xmlmind.com/xmleditor/faq.html#custom_deliverables




>
> The reason I would like to have these standard word paragraph formats is
> to make it possible to further edit the docx file.
>
> Is there a way to influence how html elements are converted to docx
> tags? If there is so and you could point me to the docs that would be
> nice, or an example...
>
>

Now about true named MS-Word styles and not just outline levels...

Generating named MS-Word styles in the DOCX created by "XMLmind XSL-FO 
Converter" is certainly possible, but requires important changes to our 
XHTML to XSL-FO XSLT stylesheets. We don't plan to make these changes.

How to do this is explained here:

"6. XSL-FO extension for generating named styles"
http://www.xmlmind.com/foconverter/_distrib/doc/user/user_styles.html








--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support