javascriptms-wordoffice-jsadd-inword-addins

Accept/Reject Tracked Changes in word document using office js api


I am using office js to track the user changes in the document:

async function setChangeTrackingMode() {
    // Sets the change tracking mode.
    await Word.run(async (context) => {
      context.document.changeTrackingMode = Word.ChangeTrackingMode.trackAll;
      await context.sync();
    });
  }

When i replace/delete some words in the document using paragraph.insertText(), it replaced and got tracked about the changes. But I don't know how to accept/reject the changes programmatically.

I didn't find any resource to help me to accept/reject tracked changes in office js.


Solution

  • Maybe you are looking for TrackedChange Apis:

    https://learn.microsoft.com/en-us/javascript/api/word/word.trackedchangecollection?view=word-js-preview https://learn.microsoft.com/en-us/javascript/api/word/word.trackedchange?view=word-js-preview