Convert any AsciiMath and MathML to Word’s native mathematical formatting language, OOXML. Word supports copy-pasting MathML into Word and converting it into OOXML; however the conversion is not infallible (we have in the past found problems with \sum: Word claims parameters were missing, and inserting dotted squares to indicate as much), and you may need to post-edit the OOXML.
The gem does attempt to repair the MathML input, to bring it in line with Word’s OOXML’s expectations. If you find any issues with AsciiMath or MathML input, please raise an issue.
Identify any footnotes in the document (defined as hyperlinks with attributes class = "Footnote" or epub:type = "footnote"), and render them as Microsoft Word footnotes.
The corresponding footnote content is any div or aside element with the same @id attribute as the footnote points to; e.g. 3, pointing to .
By default, the footnote hyperlink contents are overwritten with the autonumbering element: 1 is replaced with
If the footnote hyperlink already contains (as a child) an element marked up as , only that span is replaced by the Microsoft autonumber element; any text surrounding it is preserved in both the footnote reference and the footnote target. For example, 1) will render as the footnote 1), both in the link and the target.
Resize any local images in the HTML file to fit within the maximum page size. (Word will otherwise crash on reading the document.)
Optionally apply list styles with predefined bullet and numbering from a Word CSS to the unordered and ordered lists in the document, restarting numbering for each ordered list.
Convert all lists to native Word HTML rendering (using paragraphs with MsoListParagraphCxSpFirst, MsoListParagraphCxSpMiddle, MsoListParagraphCxSpLast styles)
Convert any internal @id anchors to a@name anchors; Word only hyperlinks to the latter.
Generate a filelist.xml listing of all files to be bundled into the Word document.
Assign the class MsoNormal to any paragraphs that do not have a class, so that they can be treated as Normal Style when editing the Word document.
Inject Microsoft Word-specific CSS into the HTML document. If a CSS file is not supplied, the CSS file used is at lib/html2doc/wordstyle.css is used by default. Microsoft Word HTML has particular requirements from its CSS, and you should review the sample CSS before replacing it with your own. (This generic CSS can be overridden by CSS already in the HTML document, since the generic CSS is injected at the top of the document.)
Bundle up the local images, the HTML file of the document proper, and the header.html file representing header/footer information, into a MIME file, and save that file to disk (so that Microsoft Word can deal with it as a Word file.)