Word.CompareTarget enum
Specifies the target document for displaying document comparison differences.
Remarks
[ API set: WordApiDesktop 1.1 ]
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/50-document/compare-documents.yaml
// Compares the current document with a specified external document.
await Word.run(async (context) => {
// Absolute path of an online or local document.
const filePath = $("#filePath")
.val()
.toString();
// Options that configure the compare operation.
const options: Word.DocumentCompareOptions = {
compareTarget: Word.CompareTarget.compareTargetCurrent,
detectFormatChanges: false
// Other options you choose...
};
context.document.compare(filePath, options);
await context.sync();
console.log("Differences shown in the current document.");
});
Fields
compareTargetCurrent = "CompareTargetCurrent" | Places comparison differences in the current document. |
compareTargetNew = "CompareTargetNew" | Places comparison differences in a new document. |
compareTargetSelected = "CompareTargetSelected" | Places comparison differences in the target document. |
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Add-ins