Is there a way to generate a Word document (.docx) in OutSystems using an HTML string as input? I have tried MSWordsUtil but it looks like the best I can do is manually assigning the format. Below example is input where receive from CKEditor.
For example, given the following HTML:
<p> This is a normal <u>paragraph</u> with <strong>important text</strong> </p>
I’d like to convert it into a Word document that keeps the formatting (underline, bold, etc.).
What would be the best approach to achieve this?
Generating a .docx from HTML (e.g., CKEditor output with bold/underline) using MSWordsUtil requires manual formatting, which is cumbersome.
Solution: Use the CreateDocxFromHtml Forge component to directly convert HTML to .docx, preserving basic formatting. Input HTML source and file path; it generates the file server-side for download.
Reference: https://www.outsystems.com/forge/component-overview/2366/createdocxfromhtml
Alternative: HTML2Word Forge component for similar HTML-to-.docx conversion.
Reference: https://www.outsystems.com/forge/component-overview/12008/html2word-o11
For client-side option: HTML To MS Word Converter (modify script for .docx output as per forum discussion).
Reference: https://www.outsystems.com/forge/component-overview/8692/html-to-ms-word-converter-o11 and https://www.outsystems.com/forums/discussion/84198/html-to-ms-word-converter-doc-to-docx-conversion/
Hey @Muhammad Faiq Roslan,
You can go with the solution proposed by Bhanu Pratap in the above comment.
Or else, there’s another workaround: convert the HTML to PDF first, and then convert the PDF to a Word document. You can easily find Forge components for both steps, and this approach is relatively simple to implement.
Choose what suits you best!
I hope this will help you.
Hi @Muhammad Faiq Roslan,
OutSystems doesn’t have a native, out‑of‑the‑box way to convert rich HTML into a .docx while preserving formatting.
And MSWordUtil is intentionally low‑level and requires you to build the document structure manually, so it won’t parse HTML for you.
Solutions:
Option 1: .NET Extension using OpenXML + HtmlToOpenXml (Recommended when accuracy matters)
This works wonders because:
Option 2: External API (Microservice or SaaS)
Best for ODC or low maintenance
Examples
Trade‑offs
Hope this helps.
Cheers,
Saugat