I’m building a React application that receives a DOCX file as a base64 string from a backend API. When opened in Google Docs, the file correctly displays tracked changes (insertions, deletions, formatting suggestions) as shown in this example:
However, when rendering the same DOCX file in React using libraries like react-doc-viewer or docx-preview, the tracked changes are not visible—only the final content appears.
What I’ve Tried:
- Converted the base64 string to a downloadable DOCX (verified the file retains track changes).
- Tested multiple React libraries (react-doc-viewer, docx-preview, mammoth.js), but none display revisions.
- Confirmed the issue is specific to rendering tracked changes (not file parsing).
Key Requirements:
- Render DOCX inline in the React UI (not as a download or external viewer).
- Preserve track changes (insertions/deletions) and formatting as shown in Google Docs.
Problem Analysis:
- Tracked changes are stored in the DOCX XML as revisions (e.g., <w:ins>, <w:del>). Most React DOCX libraries render only the final content and ignore revisions.
Possible Approaches:
- Use a library that parses DOCX XML and surfaces revisions.
- Programmatically extract tracked changes from the DOCX and overlay them on the rendered content.
Question: How can I parse and display DOCX tracked changes in a React application, mirroring Google Docs’ behavior? Are there existing methods to:
Extract revisions from a DOCX file client-side?
Transform revisions into React components (e.g., highlighted text, strike-throughs)?
Attachments: