Word.DocumentCompareOptions interface

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

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

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/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 = {
    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

True adds the document to the list of recently used files on the File menu. The default value is True.

authorName

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

The target document for the comparison. Default value is 'CompareTargetCurrent'.

detectFormatChanges

True (default) for the comparison to include detection of format changes.

ignoreAllComparisonWarnings

True compares the documents without notifying a user of problems. The default value is False.

removeDateAndTime

True removes date and time stamp information from tracked changes in the returned Document object. The default value is False.

removePersonalInformation

True removes all user information from comments, revisions, and the properties dialog box in the returned Document object. The default value is False.

Property Details

addToRecentFiles

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

True adds 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: WordApi BETA (PREVIEW ONLY) ]

authorName

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

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: WordApi BETA (PREVIEW ONLY) ]

compareTarget

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

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: WordApi BETA (PREVIEW ONLY) ]

detectFormatChanges

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

True (default) for the comparison to include detection of format changes.

detectFormatChanges?: boolean;

Property Value

boolean

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

ignoreAllComparisonWarnings

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

True compares the documents without notifying a user of problems. The default value is False.

ignoreAllComparisonWarnings?: boolean;

Property Value

boolean

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

removeDateAndTime

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

True removes 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: WordApi BETA (PREVIEW ONLY) ]

removePersonalInformation

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

True removes 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: WordApi BETA (PREVIEW ONLY) ]