Skip to content

feat(writer): added DOCX import support - #517

Open
DikshaJadhav3110 wants to merge 3 commits into
frappe:developfrom
DikshaJadhav3110:feat/writer-docx-import
Open

feat(writer): added DOCX import support#517
DikshaJadhav3110 wants to merge 3 commits into
frappe:developfrom
DikshaJadhav3110:feat/writer-docx-import

Conversation

@DikshaJadhav3110

@DikshaJadhav3110 DikshaJadhav3110 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR adds Import → DOCX support to Writer, allowing users to import Word (.docx) documents directly into the editor.

If the current document is empty, the imported content replaces it. Otherwise, the content is imported into a new tab to avoid overwriting existing work.

Closes #516

Implementation

  • Added Import → DOCX to the Writer document menu.
  • Uses mammoth.js for client-side DOCX parsing, so no backend conversion endpoint is required.
  • Uploaded images through the existing suite.writer.api.embed.add API, reusing the same upload flow as the editor.
  • Normalized imported tables to match Writer's native table structure, ensuring consistent editing and styling.
  • Preserved common formatting including headings, lists, tables, links, images, paragraphs, and inline formatting.
  • Fixed the existing Create Tab behavior so creating a tab now preserves existing content and opens a new empty tab.

Verification

Verified manually by importing multiple .docx files containing:

  • Headings
  • Paragraphs
  • Ordered and unordered lists
  • Tables
  • Hyperlinks
  • Images
  • Mixed formatting

Also verified that:

  • Importing into an empty document replaces its contents.
  • Importing into a non-empty document creates a new tab.
  • Imported images are uploaded correctly.
  • Imported tables remain editable and match Writer's native table behavior.
  • No console errors were observed during import.

Notes

  • Table formatting is normalized to Writer's table model, so imported tables behave the same as tables created inside Writer.
  • Headers and footers (including images in them) are not imported; mammoth does not read those parts of a .docx and Writer has no header/footer to map them onto.
Screen.Recording.2026-08-07.at.1.24.02.PM.mov

@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (3): Last reviewed commit: "revert(writer): keep Create tab behaviou..." | Re-trigger Greptile

Comment thread frontend/src/apps/writer/utils/docximporter.js
Comment thread frontend/src/apps/writer/utils/docximporter.js
@DikshaJadhav3110 DikshaJadhav3110 changed the title feat(writer): Added DOCX import support feat(writer): added DOCX import support Aug 6, 2026
@BreadGenie

Copy link
Copy Markdown
Member

Try to add demos instead of a long PR description. It would make it much easier to review the PR.

A picture gif is worth a thousand words.

@DikshaJadhav3110

Copy link
Copy Markdown
Collaborator Author

Thanks for the feedback @BreadGenie. I've added a demo video to the PR so the changes are easier to review, and I'll keep future PR descriptions more concise as well.

@DikshaJadhav3110
DikshaJadhav3110 force-pushed the feat/writer-docx-import branch from 0bd627c to 0ea2d25 Compare August 11, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Import DOCX files into Writer

2 participants