CompareOptions

Inheritance: java.lang.Object

public class CompareOptions

Allows configuring the process of document comparison.

Example usage:


 try (Comparer comparer = new Comparer(sourceFile)) {
     comparer.add(targetFile);

     final StyleSettings styleSettings = new StyleSettings();
     styleSettings.setHighlightColor(Color.RED);
     styleSettings.setFontColor(Color.GREEN);
     styleSettings.setUnderline(true);

     CompareOptions compareOptions = new CompareOptions();
     compareOptions.setInsertedItemStyle(styleSettings);

     comparer.compare(resultFile, compareOptions);
 }
 

Constructors

Constructor Description
CompareOptions() Initializes a new instance of the CompareOptions class.
CompareOptions(StyleSettings insertedItemStyle, StyleSettings deletedItemStyle, StyleSettings changedItemStyle) Initializes a new instance of the CompareOptions class with settings for different styles.

Methods

Method Description
getUserMasterPath() Gets the path to the user master’s template for Diagrams.
setUserMasterPath(String userMasterPath) Sets the path to the user master’s template for Diagrams.
getRevisionAuthorName() Gets or sets revision author name.
setRevisionAuthorName(String revisionAuthorName) Sets the revision author name.
isLeaveGaps() Gets a flag that determines whether to leave empty lines instead of inserted/deleted components or not.
setLeaveGaps(boolean value) Sets a flag that determines whether to leave empty lines instead of inserted/deleted components or not.
getComparisonType() Gets a type of source and target documents as ComparisonType object so that Comparison will know how to compare them.
setComparisonType(ComparisonType comparisonType) Sets a type of source and target documents as ComparisonType object so that Comparison will know how to compare them.
getPaperSize() Gets a size of a paper in result document as PaperSize object.
setPaperSize(PaperSize value) Sets a size of a paper in result document as PaperSize object.
getCalculateCoordinatesMode() Gets a calculate coordinates mode as CalculateCoordinatesModeEnumeration object.
setCalculateCoordinatesMode(CalculateCoordinatesModeEnumeration calculateCoordinatesMode) Sets a calculate coordinates mode as CalculateCoordinatesModeEnumeration object.
isShowDeletedContent() Gets a flag that indicates whether to show deleted components in resultant document or not.
setShowDeletedContent(boolean value) Sets a flag that indicates whether to show deleted components in resultant document or not.
isShowInsertedContent() Gets a flag that indicates whether to show inserted components in resultant document or not.
setShowInsertedContent(boolean value) Sets a flag that indicates whether to show inserted components in resultant document or not.
isGenerateSummaryPage() Gets a flag that indicates whether to add summary page with detected changes statistics to resultant document or not.
setGenerateSummaryPage(boolean value) Sets a flag that indicates whether to add summary page with detected changes statistics to resultant document or not.
isExtendedSummaryPage() Gets a flag that indicates whether to add extended file comparison information to the summary page or not.
setExtendedSummaryPage(boolean value) Sets a flag that indicates whether to add extended file comparison information to the summary page or not.
isShowOnlySummaryPage() Gets a flag that indicates whether to leave in the resulting document only a page with statistics of detected changes or not.
setShowOnlySummaryPage(boolean value) Sets a flag that indicates whether to leave in the resulting document only a page with statistics of detected changes or not.
isDetectStyleChanges() Gets a flag that indicates whether to detect style changes or not.
setDetectStyleChanges(boolean value) Sets a flag that indicates whether to detect style changes or not.
isMarkNestedContent() Gets a flag that indicates whether to mark the children of the deleted or inserted elements as deleted or inserted.
setMarkNestedContent(boolean value) Sets a flag that indicates whether to mark the children of the deleted or inserted elements as deleted or inserted.
isCalculateCoordinates() Gets a flag that indicates whether to calculate coordinates for changed components.
setCalculateCoordinates(boolean value) Sets a flag that indicates whether to calculate coordinates for changed components.
isHeaderFootersComparison() Gets a flag that indicates whether to compare header/footer contents.
setHeaderFootersComparison(boolean value) Sets a flag that indicates whether to compare header/footer contents.
getDetalisationLevel() Gets a level of comparison detalization represented as DetalisationLevel.
setDetalisationLevel(DetalisationLevel value) Sets a level of comparison detalization represented as DetalisationLevel.
isMarkChangedContent() Gets a flag that indicates whether frames for shapes in Word Processing and for rectangles in Image documents will be used.
setMarkChangedContent(boolean value) Sets a flag that indicates whether frames for shapes in Word Processing and for rectangles in Image documents will be used.
getInsertedItemStyle() Gets a style settings that will be applied to inserted items.
setInsertedItemStyle(StyleSettings value) Sets a style settings that will be applied to inserted items.
getDeletedItemStyle() Gets a style settings that will be applied to deleted items.
setDeletedItemStyle(StyleSettings value) Sets a style settings that will be applied to deleted items.
getChangedItemStyle() Gets a style settings that will be applied to changed items.
setChangedItemStyle(StyleSettings value) Sets a style settings that will be applied to changed items.
isCompareBookmarks() Gets a flag that indicates whether bookmarks in Word documents will be compared.
setCompareBookmarks(boolean value) Sets a flag that indicates whether bookmarks in Word documents should be compared.
isCompareVariableProperty() Gets a flag that indicates whether variables properties in Word documents will be compared.
setCompareVariableProperty(boolean value) Sets a flag that indicates whether variables properties in Word documents should be compared.
isCompareDocumentProperty() Gets a flag that indicates whether built and custom properties in Word documents will be compared.
setCompareDocumentProperty(boolean value) Sets a flag that indicates whether built and custom properties in Word documents should be compared.
getSensitivityOfComparison() Gets a sensitivity of comparison.
setSensitivityOfComparison(int value) Sets a sensitivity of comparison.
setWordsSeparatorChars(char[] value) Sets an array of delimiters which will be used to split text into words.
getPasswordSaveOption() Gets a password save option represented by PasswordSaveOption object.
setPasswordSaveOption(PasswordSaveOption value) Sets a password save option represented by PasswordSaveOption object.
getOriginalSize() Gets an original sizes of compared documents represented by OriginalSize object.
setOriginalSize(OriginalSize value) Sets an original sizes of compared documents represented by OriginalSize object.
getDiagramMasterSetting() Gets a setting of master page for Diagram documents represented by DiagramMasterSetting object.
setDiagramMasterSetting(DiagramMasterSetting value) Sets a setting of master page for Diagram documents represented by DiagramMasterSetting object.
isShowRevisions() Gets a flag that indicates whether others revisions in the resulting document will be displayed.
setShowRevisions(boolean value) Sets a flag that indicates whether others revisions in the resulting document should be displayed.
isWordTrackChanges() Gets a flag that indicates whether Words Track Revisions will be compared.
setWordTrackChanges(boolean value) Sets a flag that indicates whether Words Track Revisions should be compared.
isDirectoryCompare() Returns a flag that indicates whether directory comparison is enabled.
setDirectoryCompare(boolean directoryCompare) Sets a flag that indicates whether directory comparison should be enabled.
isShowOnlyChanged() Returns a boolean value that indicates whether only changed items should be displayed.
setShowOnlyChanged(boolean showOnlyChanged) Sets the value indicating whether only changed items should be displayed.
getFolderComparisonExtension() Gets the format of the resulting folder comparison file.
setFolderComparisonExtension(FolderComparisonExtension folderComparisonExtension) Sets the format of the resulting folder comparison file.

CompareOptions()

public CompareOptions()

Initializes a new instance of the CompareOptions class.

CompareOptions(StyleSettings insertedItemStyle, StyleSettings deletedItemStyle, StyleSettings changedItemStyle)

public CompareOptions(StyleSettings insertedItemStyle, StyleSettings deletedItemStyle, StyleSettings changedItemStyle)

Initializes a new instance of the CompareOptions class with settings for different styles.

Parameters:

Parameter Type Description
insertedItemStyle StyleSettings Style settings for inserted items
deletedItemStyle StyleSettings Style settings for deleted items
changedItemStyle StyleSettings Style settings for changed style items

getUserMasterPath()

public String getUserMasterPath()

Gets the path to the user master’s template for Diagrams.

Returns: java.lang.String - The path to the user master’s template for Diagrams.

setUserMasterPath(String userMasterPath)

public void setUserMasterPath(String userMasterPath)

Sets the path to the user master’s template for Diagrams.

Parameters:

Parameter Type Description
userMasterPath java.lang.String The path to the user master’s template for Diagrams.

getRevisionAuthorName()

public String getRevisionAuthorName()

Gets or sets revision author name. Enabled if not null.

Returns: java.lang.String - The revision author name.

setRevisionAuthorName(String revisionAuthorName)

public void setRevisionAuthorName(String revisionAuthorName)

Sets the revision author name. Enabled if not null.

Parameters:

Parameter Type Description
revisionAuthorName java.lang.String The new revision author name to be set.

isLeaveGaps()

public boolean isLeaveGaps()

Gets a flag that determines whether to leave empty lines instead of inserted/deleted components or not.

Whether to display empty lines instead of inserted/deleted components in the final document or not. Used with isShowInsertedContent() or isShowDeletedContent() properties.

Returns: boolean - true if empty lines should be displayed instead of inserted/deleted components, otherwise false

setLeaveGaps(boolean value)

public void setLeaveGaps(boolean value)

Sets a flag that determines whether to leave empty lines instead of inserted/deleted components or not.

Whether to display empty lines instead of inserted/deleted components in the final document or not. Used with isShowInsertedContent() or isShowDeletedContent() properties.

Parameters:

Parameter Type Description
value boolean true if empty lines should be displayed instead of inserted/deleted components, otherwise false

getComparisonType()

public ComparisonType getComparisonType()

Gets a type of source and target documents as ComparisonType object so that Comparison will know how to compare them.

When this option is set, LoadOptions.getFileType() option will be omitted.

Returns: ComparisonType - the type of source and target documents

setComparisonType(ComparisonType comparisonType)

public void setComparisonType(ComparisonType comparisonType)

Sets a type of source and target documents as ComparisonType object so that Comparison will know how to compare them.

When this option is set, LoadOptions.setFileType(FileType) option will be omitted.

Parameters:

Parameter Type Description
comparisonType ComparisonType The type of source and target documents

getPaperSize()

public final PaperSize getPaperSize()

Gets a size of a paper in result document as PaperSize object.

Returns: PaperSize - the size of a paper in result document

setPaperSize(PaperSize value)

public final void setPaperSize(PaperSize value)

Sets a size of a paper in result document as PaperSize object.

Parameters:

Parameter Type Description
value PaperSize The size of a paper in result document

getCalculateCoordinatesMode()

public CalculateCoordinatesModeEnumeration getCalculateCoordinatesMode()

Gets a calculate coordinates mode as CalculateCoordinatesModeEnumeration object.

Returns: CalculateCoordinatesModeEnumeration - the calculate coordinates mode

setCalculateCoordinatesMode(CalculateCoordinatesModeEnumeration calculateCoordinatesMode)

public void setCalculateCoordinatesMode(CalculateCoordinatesModeEnumeration calculateCoordinatesMode)

Sets a calculate coordinates mode as CalculateCoordinatesModeEnumeration object.

Parameters:

Parameter Type Description
calculateCoordinatesMode CalculateCoordinatesModeEnumeration The calculate coordinates mode

isShowDeletedContent()

public final boolean isShowDeletedContent()

Gets a flag that indicates whether to show deleted components in resultant document or not.

Returns: boolean - true if deleted components in resultant document will be shown, otherwise false

setShowDeletedContent(boolean value)

public final void setShowDeletedContent(boolean value)

Sets a flag that indicates whether to show deleted components in resultant document or not.

Parameters:

Parameter Type Description
value boolean true if deleted components in resultant document should be shown, otherwise false

isShowInsertedContent()

public final boolean isShowInsertedContent()

Gets a flag that indicates whether to show inserted components in resultant document or not.

Returns: boolean - true if inserted components in resultant document should be shown, otherwise false

setShowInsertedContent(boolean value)

public final void setShowInsertedContent(boolean value)

Sets a flag that indicates whether to show inserted components in resultant document or not.

Parameters:

Parameter Type Description
value boolean true if inserted components in resultant document should be shown, otherwise false

isGenerateSummaryPage()

public final boolean isGenerateSummaryPage()

Gets a flag that indicates whether to add summary page with detected changes statistics to resultant document or not.

Returns: boolean - true if summary page will be added, otherwise false

setGenerateSummaryPage(boolean value)

public final void setGenerateSummaryPage(boolean value)

Sets a flag that indicates whether to add summary page with detected changes statistics to resultant document or not.

Parameters:

Parameter Type Description
value boolean true if summary page should be added, otherwise false

isExtendedSummaryPage()

public boolean isExtendedSummaryPage()

Gets a flag that indicates whether to add extended file comparison information to the summary page or not.

Returns: boolean - true if extended file comparison information will be added to summary page, otherwise false

setExtendedSummaryPage(boolean value)

public void setExtendedSummaryPage(boolean value)

Sets a flag that indicates whether to add extended file comparison information to the summary page or not.

Parameters:

Parameter Type Description
value boolean true if extended file comparison information should be added to summary page, otherwise false

isShowOnlySummaryPage()

public boolean isShowOnlySummaryPage()

Gets a flag that indicates whether to leave in the resulting document only a page with statistics of detected changes or not.

Returns: boolean - true if in the resulting document only a page with statistics of detected changes will be left, otherwise false

setShowOnlySummaryPage(boolean value)

public void setShowOnlySummaryPage(boolean value)

Sets a flag that indicates whether to leave in the resulting document only a page with statistics of detected changes or not.

Parameters:

Parameter Type Description
value boolean true if in the resulting document only a page with statistics of detected changes should be left, otherwise false

isDetectStyleChanges()

public final boolean isDetectStyleChanges()

Gets a flag that indicates whether to detect style changes or not.

Returns: boolean - true if style changes will be detected, otherwise false

setDetectStyleChanges(boolean value)

public final void setDetectStyleChanges(boolean value)

Sets a flag that indicates whether to detect style changes or not.

Parameters:

Parameter Type Description
value boolean true if style changes should be detected, otherwise false

isMarkNestedContent()

public final boolean isMarkNestedContent()

Gets a flag that indicates whether to mark the children of the deleted or inserted elements as deleted or inserted.

Returns: boolean - true if the children of the deleted or inserted elements will be marked as deleted or inserted, otherwise false

setMarkNestedContent(boolean value)

public final void setMarkNestedContent(boolean value)

Sets a flag that indicates whether to mark the children of the deleted or inserted elements as deleted or inserted.

Parameters:

Parameter Type Description
value boolean true if the children of the deleted or inserted elements should be marked as deleted or inserted, otherwise false

isCalculateCoordinates()

public final boolean isCalculateCoordinates()

Gets a flag that indicates whether to calculate coordinates for changed components.

Returns: boolean - true if coordinates for changed components will be calculated, otherwise false

setCalculateCoordinates(boolean value)

public final void setCalculateCoordinates(boolean value)

Sets a flag that indicates whether to calculate coordinates for changed components.

Parameters:

Parameter Type Description
value boolean true if coordinates for changed components should be calculated, otherwise false

isHeaderFootersComparison()

public final boolean isHeaderFootersComparison()

Gets a flag that indicates whether to compare header/footer contents.

Returns: boolean - true if header/footer contents will be compared, otherwise false

setHeaderFootersComparison(boolean value)

public final void setHeaderFootersComparison(boolean value)

Sets a flag that indicates whether to compare header/footer contents.

Parameters:

Parameter Type Description
value boolean true if header/footer contents should be compared, otherwise false

getDetalisationLevel()

public final DetalisationLevel getDetalisationLevel()

Gets a level of comparison detalization represented as DetalisationLevel.

Default value is DetalisationLevel.LOW.

Returns: DetalisationLevel - the level of comparison detalization

setDetalisationLevel(DetalisationLevel value)

public final void setDetalisationLevel(DetalisationLevel value)

Sets a level of comparison detalization represented as DetalisationLevel.

Default value is DetalisationLevel.LOW

Parameters:

Parameter Type Description
value DetalisationLevel The level of comparison detalization

isMarkChangedContent()

public final boolean isMarkChangedContent()

Gets a flag that indicates whether frames for shapes in Word Processing and for rectangles in Image documents will be used.

Returns: boolean - true if frames will be used, otherwise false

setMarkChangedContent(boolean value)

public final void setMarkChangedContent(boolean value)

Sets a flag that indicates whether frames for shapes in Word Processing and for rectangles in Image documents will be used.

Parameters:

Parameter Type Description
value boolean true if frames should be used, otherwise false

getInsertedItemStyle()

public final StyleSettings getInsertedItemStyle()

Gets a style settings that will be applied to inserted items.

Returns: StyleSettings - style settings of inserted items

setInsertedItemStyle(StyleSettings value)

public final void setInsertedItemStyle(StyleSettings value)

Sets a style settings that will be applied to inserted items.

Parameters:

Parameter Type Description
value StyleSettings Style settings of inserted items

getDeletedItemStyle()

public final StyleSettings getDeletedItemStyle()

Gets a style settings that will be applied to deleted items.

Returns: StyleSettings - style settings of deleted items

setDeletedItemStyle(StyleSettings value)

public final void setDeletedItemStyle(StyleSettings value)

Sets a style settings that will be applied to deleted items.

Parameters:

Parameter Type Description
value StyleSettings Style settings of deleted items

getChangedItemStyle()

public final StyleSettings getChangedItemStyle()

Gets a style settings that will be applied to changed items.

Returns: StyleSettings - style settings of changed items

setChangedItemStyle(StyleSettings value)

public final void setChangedItemStyle(StyleSettings value)

Sets a style settings that will be applied to changed items.

Parameters:

Parameter Type Description
value StyleSettings Style settings of changed items

isCompareBookmarks()

public boolean isCompareBookmarks()

Gets a flag that indicates whether bookmarks in Word documents will be compared.

Returns: boolean - true if bookmarks in Word documents will be compared, otherwise false

setCompareBookmarks(boolean value)

public void setCompareBookmarks(boolean value)

Sets a flag that indicates whether bookmarks in Word documents should be compared.

Parameters:

Parameter Type Description
value boolean true if bookmarks in Word documents should be compared, otherwise false

isCompareVariableProperty()

public boolean isCompareVariableProperty()

Gets a flag that indicates whether variables properties in Word documents will be compared.

Returns: boolean - true if variables properties in Word documents will be compared, otherwise false

setCompareVariableProperty(boolean value)

public void setCompareVariableProperty(boolean value)

Sets a flag that indicates whether variables properties in Word documents should be compared.

Parameters:

Parameter Type Description
value boolean true if variables properties in Word documents should be compared, otherwise false

isCompareDocumentProperty()

public boolean isCompareDocumentProperty()

Gets a flag that indicates whether built and custom properties in Word documents will be compared.

Returns: boolean - true if built and custom properties in Word documents will be compared, otherwise false

setCompareDocumentProperty(boolean value)

public void setCompareDocumentProperty(boolean value)

Sets a flag that indicates whether built and custom properties in Word documents should be compared.

Parameters:

Parameter Type Description
value boolean true if built and custom properties in Word documents should be compared, otherwise false

getSensitivityOfComparison()

public final int getSensitivityOfComparison()

Gets a sensitivity of comparison.

The percentage of deleted and inserted elements of two compared objects in relation to all elements of these objects.

  • If this percentage if exceeded, the object aren’t compared but are considered completely inserted and deleted.
  • Min value - 0% => The comparison doesn’t occur for any length of the common subsequence of two compared object.
  • Default value - 75% => Comparison occurs if the percentage of deleted and inserted elements of two compared object with respect to all elements of these objects isn’t more then 75.
  • Max value - 100% => The comparison occurs at any length of the common subsequence of two compared objects.

Returns: int - the sensitivity of comparison

setSensitivityOfComparison(int value)

public final void setSensitivityOfComparison(int value)

Sets a sensitivity of comparison.

The percentage of deleted and inserted elements of two compared objects in relation to all elements of these objects.

  • If this percentage if exceeded, the object aren’t compared but are considered completely inserted and deleted.
  • Min value - 0% => The comparison doesn’t occur for any length of the common subsequence of two compared object.
  • Default value - 75% => Comparison occurs if the percentage of deleted and inserted elements of two compared object with respect to all elements of these objects isn’t more then 75.
  • Max value - 100% => The comparison occurs at any length of the common subsequence of two compared objects.

Parameters:

Parameter Type Description
value int The sensitivity of comparison

setWordsSeparatorChars(char[] value)

public final void setWordsSeparatorChars(char[] value)

Sets an array of delimiters which will be used to split text into words.

Parameters:

Parameter Type Description
value char[] The array of delimiters to split text into words

getPasswordSaveOption()

public final PasswordSaveOption getPasswordSaveOption()

Gets a password save option represented by PasswordSaveOption object.

Returns: PasswordSaveOption - the password save option

setPasswordSaveOption(PasswordSaveOption value)

public final void setPasswordSaveOption(PasswordSaveOption value)

Sets a password save option represented by PasswordSaveOption object.

Parameters:

Parameter Type Description
value PasswordSaveOption The password save option

getOriginalSize()

public final OriginalSize getOriginalSize()

Gets an original sizes of compared documents represented by OriginalSize object.

Returns: OriginalSize - the original size of documents

setOriginalSize(OriginalSize value)

public final void setOriginalSize(OriginalSize value)

Sets an original sizes of compared documents represented by OriginalSize object.

Parameters:

Parameter Type Description
value OriginalSize The original size of documents

getDiagramMasterSetting()

public final DiagramMasterSetting getDiagramMasterSetting()

Gets a setting of master page for Diagram documents represented by DiagramMasterSetting object.

Returns: DiagramMasterSetting - the diagram master page setting

setDiagramMasterSetting(DiagramMasterSetting value)

public final void setDiagramMasterSetting(DiagramMasterSetting value)

Sets a setting of master page for Diagram documents represented by DiagramMasterSetting object.

Parameters:

Parameter Type Description
value DiagramMasterSetting The diagram master page setting

isShowRevisions()

public boolean isShowRevisions()

Gets a flag that indicates whether others revisions in the resulting document will be displayed.

Returns: boolean - value true if others revisions in the resulting document will be displayed, otherwise false

setShowRevisions(boolean value)

public void setShowRevisions(boolean value)

Sets a flag that indicates whether others revisions in the resulting document should be displayed.

Parameters:

Parameter Type Description
value boolean true if others revisions in the resulting document should be displayed, otherwise false

isWordTrackChanges()

public boolean isWordTrackChanges()

Gets a flag that indicates whether Words Track Revisions will be compared.

Returns: boolean - true if Words Track Revisions will be compared, otherwise false

setWordTrackChanges(boolean value)

public void setWordTrackChanges(boolean value)

Sets a flag that indicates whether Words Track Revisions should be compared.

Parameters:

Parameter Type Description
value boolean true if Words Track Revisions should be compared, otherwise false

isDirectoryCompare()

public boolean isDirectoryCompare()

Returns a flag that indicates whether directory comparison is enabled.

Returns: boolean - true if directory comparison is enabled, otherwise false

setDirectoryCompare(boolean directoryCompare)

public void setDirectoryCompare(boolean directoryCompare)

Sets a flag that indicates whether directory comparison should be enabled.

Parameters:

Parameter Type Description
directoryCompare boolean true if directory comparison should be enabled, otherwise false

isShowOnlyChanged()

public boolean isShowOnlyChanged()

Returns a boolean value that indicates whether only changed items should be displayed.

Returns: boolean - true if only changed items should be displayed, otherwise false

setShowOnlyChanged(boolean showOnlyChanged)

public void setShowOnlyChanged(boolean showOnlyChanged)

Sets the value indicating whether only changed items should be displayed.

Parameters:

Parameter Type Description
showOnlyChanged boolean the boolean value indicating whether only changed items should be displayed

getFolderComparisonExtension()

public FolderComparisonExtension getFolderComparisonExtension()

Gets the format of the resulting folder comparison file.

Returns: com.groupdocs.comparison.options.enums.FolderComparisonExtension - the FolderComparisonExtension representing the format of the resulting folder comparison file

setFolderComparisonExtension(FolderComparisonExtension folderComparisonExtension)

public void setFolderComparisonExtension(FolderComparisonExtension folderComparisonExtension)

Sets the format of the resulting folder comparison file.

Parameters:

Parameter Type Description
folderComparisonExtension com.groupdocs.comparison.options.enums.FolderComparisonExtension the FolderComparisonExtension representing the format of the resulting folder comparison file