Edit

Share via


Word.DocumentCompareOptions interface

Specifies the options to be included in a compare document operation.

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 = (document.getElementById("filePath") as HTMLInputElement).value;
  // 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.");
});

Properties

addToRecentFiles

If provided, specifies whether to add the document to the list of recently used files on the File menu. The default value is true.

authorName

If provided, specifies the reviewer name associated with the differences generated by the comparison. If unspecified, the value defaults to the author name of the revised document or the string Comparison if no author information is present.

compareTarget

If provided, specifies the target document for the comparison. Default value is compareTargetCurrent.

detectFormatChanges

If provided, specifies whether the comparison should include detection of format changes. The default value is true.

ignoreAllComparisonWarnings

If provided, specifies whether to compare the documents without notifying a user of problems. The default value is false.

removeDateAndTime

If provided, specifies whether to remove date and time stamp information from tracked changes in the returned Document object. The default value is false.

removePersonalInformation

If provided, specifies whether to remove all user information from comments, revisions, and the properties dialog box in the returned Document object. The default value is false.

Property Details

addToRecentFiles

If provided, specifies whether to add the document to the list of recently used files on the File menu. The default value is true.

addToRecentFiles?: boolean;

Property Value

boolean

Remarks

[ API set: WordApiDesktop 1.1 ]

authorName

If provided, specifies the reviewer name associated with the differences generated by the comparison. If unspecified, the value defaults to the author name of the revised document or the string Comparison if no author information is present.

authorName?: string;

Property Value

string

Remarks

[ API set: WordApiDesktop 1.1 ]

compareTarget

If provided, specifies the target document for the comparison. Default value is compareTargetCurrent.

compareTarget?: Word.CompareTarget | "CompareTargetCurrent" | "CompareTargetSelected" | "CompareTargetNew";

Property Value

Word.CompareTarget | "CompareTargetCurrent" | "CompareTargetSelected" | "CompareTargetNew"

Remarks

[ API set: WordApiDesktop 1.1 ]

detectFormatChanges

If provided, specifies whether the comparison should include detection of format changes. The default value is true.

detectFormatChanges?: boolean;

Property Value

boolean

Remarks

[ API set: WordApiDesktop 1.1 ]

ignoreAllComparisonWarnings

If provided, specifies whether to compare the documents without notifying a user of problems. The default value is false.

ignoreAllComparisonWarnings?: boolean;

Property Value

boolean

Remarks

[ API set: WordApiDesktop 1.1 ]

removeDateAndTime

If provided, specifies whether to remove date and time stamp information from tracked changes in the returned Document object. The default value is false.

removeDateAndTime?: boolean;

Property Value

boolean

Remarks

[ API set: WordApiDesktop 1.1 ]

removePersonalInformation

If provided, specifies whether to remove all user information from comments, revisions, and the properties dialog box in the returned Document object. The default value is false.

removePersonalInformation?: boolean;

Property Value

boolean

Remarks

[ API set: WordApiDesktop 1.1 ]