1

I am currently using the compare() function to compare two files, and when the changes appear on the Word side, I want to use getTrackedChanges() to retrieve those changes. However, when I log it using console.log, the items array is empty.

I want to use compare to compare file 1 and file 2. When I set file 1 as the current file, I can retrieve the changes in the items, but when I set file 2 as the current file, I am unable to do so.

const compareFiles = async () => {
    const createdBy = “name”
    try {
      await Word.run(async (context) => {
        const options = {
          authorName: createdBy,
        };
        context.document.compare(“https:demo.blob.test”, options);
        await context.sync();
      });
    } catch (error) {
      console.log("error: ", error);
    }
};


const getTrackedChanges = async () => {
      await Word.run(async (context) => {
        const body = context.document.body;
        const trackedChanges = body.getTrackedChanges();
        trackedChanges.load("items");
        await context.sync();
     }
};

Does anyone have a solution that could help me?

1
  • Wouldn't you at least need that https: to be https:// ? Commented Dec 31, 2024 at 7:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.