The Docx to HTML Convert Tool module provides a purely front-end solution powered by mammoth.js to convert content from Docx to HTML. Since CKEditor 5, the 'Paste from Word (Office)' feature has been limited in its free version. This module allows content authors to copy content from a Docx file and paste it into any long text field, preserving as much of the original styling as possible.
Features
- Front-end solution, no file uploaded to the server.
- Converted HTML content can be pasted to any long text field
- Preview converted content rendered with current front theme.
- Support following styling copied from a docx file.
- Headings.
- Lists.
- Customisable mapping.
- Tables.
- Footnotes and endnotes.
- Images.
- Bold, italics, underlines, strikethrough, superscript and subscript.
- Links.
- Line breaks.
- Text boxes.
- Comments.
- And more to come
Post-Installation
The mammoth.js 1.8.0 has already been included in this module. No need to install it separately.
How to use?
- Enable the module.
- Navigate to Administration > Configuration > Content authoring > DOCX to HTML Converter, or directly access it via the URL /docx-to-html. Note that the 'Access DOCX to HTML Converter' permission is required.
- Choose a Docx file from your local machine. The converted HTML preview will automatically display below, and a 'Copy the HTML' button will appear to copy the entire converted content with HTML styling into the clipboard.
Notes
- CKEditor 5 has its own tag and attribute restrictions. Some HTML tags or attributes pasted into the editor might be filtered out (e.g., H1 tag, IMG tag). If this happens, check the editor and format settings.
- When copying HTML codes and pasting them into a Drupal text field, ensure that the target text field and format can sanitise (escape) malicious HTML tags and attributes, such as the Script tag.
Credits
This module is powered by mammoth.js.
Project information
- Project categories: Content editing experience
16 sites report using this module
- Created by mingsong on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.

