Export tracked changes to DOCX
Tracked Changes add-on
Tracked Changes is a paid add-on that isn't included in any plan. Test it during the free trial or purchase it in your dashboard. Once integrated in your editor, it works with Conversion to round-trip reviews between Word and Tiptap.
Text carrying a tracked changes suggestion is exported as a real Word revision, so it appears in Word's review pane and can be accepted or rejected there.
How it works
Nothing to configure. If the content you export has suggestions on it, they become revisions:
editor.chain().exportDocx().run()| Mark type | Becomes |
|---|---|
add | A Word insertion |
delete | A Word deletion |
replaceInsertion | The insertion half of an edit |
replaceDeletion | The deletion half of an edit |
These are the values on the suggestion mark itself. The tracked changes query API reports the last two together as a single replace suggestion, so you see replace there and the two halves here.
A replacement is written as a deletion immediately followed by an insertion, which is how Word represents text being swapped for other text. Imported documents only ever carry add and delete, so the two halves come from edits made in the editor.
Author and date
Each revision carries the reviewer's name and a timestamp, taken from the suggestion:
- The name comes from
userMetadata.name. Without one it falls back touserId, and failing that toanonymous. - The date comes from
createdAt. A suggestion with no usable timestamp gets a fixed placeholder date, because Word rejects a revision with an empty one.
Opening the file in Word shows these in the review pane, grouped by reviewer, exactly as if the edits had been made in Word.
What is not exported (work in progress)
In each of these the content itself is exported, so the document reads correctly in Word. What is missing is the record that a particular thing was a tracked change.
- Formatting suggestions. A suggestion recording that text was made bold is not written as a Word formatting revision. The formatting is exported, so the text looks right, but it does not appear as a tracked change.
- Suggestions on images and other standalone content. Import records these as node attributes rather than as a mark, and the export reads marks only. The image is exported and its insertion or deletion is dropped, so it cannot be accepted or rejected in Word.
- A suggestion on a link. Word cannot wrap a hyperlink in a revision, so one of the two is always lost, and which one depends on the direction. An inserted link keeps the link and drops the revision. A deleted link keeps the deletion and drops the link. A warning is logged either way.
- One stacking order of overlapping suggestions. Where a deletion and an insertion sit on the same text, one reviewer deleting what another inserted is written with both revisions nested, so Word shows both authors. The opposite stacking order is written as the deletion alone.
Round-trip
A document imported from Word with trackedChanges: 'preserve' and exported again keeps its revisions, along with each reviewer's name and date.
One detail changes shape. Word writes one revision record per run of text, and the export does the same, so a single suggestion that spans differently formatted text is written as several adjacent revisions rather than one. Word groups them back together in its review pane, so a reader sees the same set of changes.
Accepting in Word matches accepting in Tiptap
Accepting every change in Word produces the same text as importing the same file with
trackedChanges: 'accept', and rejecting everything matches trackedChanges: 'reject'. The
exceptions are the cases in what is not exported, where
the revision is not written and so cannot be accepted or rejected.