Hi ,
I am trying to build a custom component that can take HTML content from my app (including images, tables, and styled text) and export it as a downloadable Word document (.doc / .docx) to local storage.
I have tried different approaches:
- Wrapping HTML in a
.doc
MIME type β works for simple text, but not a real.docx
. - Using the
docx
NPM library β generates valid.docx
, but it strips out most HTML formatting (tables, images, bold/italic, etc.). - Using
html-docx-js
β preserves formatting, but when I include images (hosted on Retool Storage with signed URLs), they appear as broken links (cross icon) inside Word instead of displaying correctly.
My challenges:
- Need to generate a valid Word file (
.doc
or.docx
) directly from HTML. - Preserve images and tables from the original HTML (images are uploaded in Retool storage).
- File should be downloaded to local storage after export.
Hereβs a screenshot of the issue when opening the Word file:
Has anyone found a reliable way to handle this? Or is there a recommended Retool-compatible library / workflow for exporting full HTML (with images + tables) to Word?