Allow for formatted raw HTML to be included in DOCX

Allow for formatted raw HTML to be included in DOCX

Postby Otto » Sun Jan 14, 2018 7:11 pm

in case someone needs formatted raw HTML to be included in DOCX.
Best regards,


Docx- file rename to Zip and unzip

Copy your MHT file to the word directory of the zip

Search for placeholder in document.xml and replace with
<w:altChunk r:id="htmlDoc" />
word/document.xml - main XML document containing reference to imported file ("w:altChunk" element)

altChunk (Anchor for Imported External Content)
This element specifies a location within a document for the insertion of the contents of a specified file containing external content to be imported into the main WordprocessingML document.
The altChunk element specifies that the external content targeted by the relationship with an ID of altChunk1 must be imported at the beginning of the document.

<Relationship Type="" Target="/word/htmlDoc.html" Id="htmlDoc" />
The corresponding relationship part item shows that the file to be imported is located next to the main document and is named import.htm. end example]

[Content_Types].xml - contains declaration of "altChunk" content type (mime type - "text/html"; mime type for MHTML is "message/rfc822"):
<Override PartName="/word/htmlDoc.html" ContentType="text/html"/>

User avatar
Posts: 3301
Joined: Fri Oct 07, 2005 7:07 pm

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], horacio and 8 guests