mammoth.js
mammoth.js copied to clipboard
[Question] Is there a way to get document "tracked changes"?
Hey! Great lib. I wonder if I could also somehow get the tracked changes while converting the document.
Well, I have a document with "Track Changes" enabled. And when I tried to convert it using transformDocument function I didn't see any additional data that might belong to those tracked changes.
So, is this possible? Or maybe it'll be possible in the future?
Could you provide a minimal example document, the HTML you'd like to get, and the HTML you're actually getting?
Oh, I guess you might have misunderstood me.
The conversion, the default conversion works fine, I don't have any issue with that.
What I actually want is to be able to show the "tracked changes" of Microsoft Document in HTML.
So to achieve that I tried to customize the conversion with the help of transformDocument option.
I looked into the elements that are handled by transformDocument option and I didn't find any "Track Changes" data there.
I suppose this data is inside .docx file. But I didn't see this data in transformDocument option function.
I just console.log the element in the transformDocument function, but the element only has the latest "text" object.
const mammoth = require("mammoth");
function transformElements(element) {
console.log(JSON.stringify(element));
return element;
}
mammoth.convertToHtml({ path: "tracking-changes.docx" }, {
transformDocument: transformElements
}).then(console.log).done();
The document with "Track Changes" enabled: tracking-changes.docx
Looks like:

I would like to convert it to:
<p>H<del>ello</del><ins>i all</ins>.</p>
Is this possible?
+1
Is this possible?
Not at the moment, no.
Can we fix it?