CompareOptions
Leave feedback
On this page
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);
}
| 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. |
| Field | Description |
|---|---|
| ignoreChangeSettings |
| Method | Description |
|---|---|
| getIgnoreChangeSettings() | Get settings to ignore changes based on similarity. |
| setIgnoreChangeSettings(IgnoreChangeSensitivitySettings ignoreChangeSettings) | Sets settings to ignore changes based on similarity. |
| 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. |
| 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. |
| isCompareImagesPdf() | Get a value indicating whether to compare images. |
| setCompareImagesPdf(boolean compareImagesPdf) | Set a value indicating whether to compare images. |
| getImagesInheritanceMode() | Get a value indicating whether images inheritance mode |
| setImagesInheritanceMode(ImagesInheritance imagesInheritanceMode) | Set a value indicating whether to images inheritance mode. |
| getSensitivityOfComparison() | Gets a sensitivity of comparison. |
| setSensitivityOfComparison(int value) | Sets a sensitivity of comparison. |
| setSensitivityOfComparisonForTables(Integer value) | Sets a sensitivity of comparison for tables. |
| getSensitivityOfComparisonForTables() | Get a sensitivity of comparison for tables. |
| 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. |
| 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. |
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 |
public IgnoreChangeSensitivitySettings ignoreChangeSettings
public IgnoreChangeSensitivitySettings getIgnoreChangeSettings()
Get settings to ignore changes based on similarity.
Returns: com.groupdocs.comparison.options.IgnoreChangeSensitivitySettings - Settings to ignore changes.
public void setIgnoreChangeSettings(IgnoreChangeSensitivitySettings ignoreChangeSettings)
Sets settings to ignore changes based on similarity.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| ignoreChangeSettings | com.groupdocs.comparison.options.IgnoreChangeSensitivitySettings | Settings to ignore changes. |
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.
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. |
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
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 |
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
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 |
public CalculateCoordinatesModeEnumeration getCalculateCoordinatesMode()
Gets a calculate coordinates mode as CalculateCoordinatesModeEnumeration object.
Returns: CalculateCoordinatesModeEnumeration - the calculate coordinates mode
public void setCalculateCoordinatesMode(CalculateCoordinatesModeEnumeration calculateCoordinatesMode)
Sets a calculate coordinates mode as CalculateCoordinatesModeEnumeration object.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| calculateCoordinatesMode | CalculateCoordinatesModeEnumeration | The calculate coordinates mode |
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
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 |
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
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 |
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
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 |
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
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 |
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
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 |
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
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 |
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
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 |
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
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 |
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
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 |
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
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 |
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
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 |
public final StyleSettings getInsertedItemStyle()
Gets a style settings that will be applied to inserted items.
Returns: StyleSettings - style settings of inserted items
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 |
public final StyleSettings getDeletedItemStyle()
Gets a style settings that will be applied to deleted items.
Returns: StyleSettings - style settings of deleted items
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 |
public final StyleSettings getChangedItemStyle()
Gets a style settings that will be applied to changed items.
Returns: StyleSettings - style settings of changed items
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 |
public boolean isCompareImagesPdf()
Get a value indicating whether to compare images.
Returns: boolean - compare images
public void setCompareImagesPdf(boolean compareImagesPdf)
Set a value indicating whether to compare images.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| compareImagesPdf | boolean | Compare images |
public ImagesInheritance getImagesInheritanceMode()
Get a value indicating whether images inheritance mode
Returns: com.groupdocs.comparison.options.enums.ImagesInheritance - compare images
public void setImagesInheritanceMode(ImagesInheritance imagesInheritanceMode)
Set a value indicating whether to images inheritance mode.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| imagesInheritanceMode | com.groupdocs.comparison.options.enums.ImagesInheritance | Images inheritance mode |
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
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 |
public void setSensitivityOfComparisonForTables(Integer value)
Sets a sensitivity of comparison for tables. If the value is null, SensitivityOfComparison is used instead. 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 | java.lang.Integer | The sensitivity of comparison for tables |
public final Integer getSensitivityOfComparisonForTables()
Get a sensitivity of comparison for tables. If the value is null, SensitivityOfComparison is used instead. 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: java.lang.Integer - The sensitivity of comparison for tables
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 |
public final PasswordSaveOption getPasswordSaveOption()
Gets a password save option represented by PasswordSaveOption object.
Returns: PasswordSaveOption - the password save option
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 |
public final OriginalSize getOriginalSize()
Gets an original sizes of compared documents represented by OriginalSize object.
Returns: OriginalSize - the original size of documents
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 |
public final DiagramMasterSetting getDiagramMasterSetting()
Gets a setting of master page for Diagram documents represented by DiagramMasterSetting object.
Returns: DiagramMasterSetting - the diagram master page setting
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 |
public boolean isDirectoryCompare()
Returns a flag that indicates whether directory comparison is enabled.
Returns: boolean - true if directory comparison is enabled, otherwise false
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 |
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
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 |
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
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 |
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.