public class CompareOptions extends Object
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);
}
Comparer,
StyleSettings| Modifier and Type | Class and Description |
|---|---|
static class |
CompareOptions.Builder
A
CompareOptions builder. |
| Modifier and Type | Field and Description |
|---|---|
com.groupdocs.comparison.options.IgnoreChangeSensitivitySettings |
ignoreChangeSettings |
| Constructor and 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.
|
| Modifier and Type | Method and Description |
|---|---|
CalculateCoordinatesModeEnumeration |
getCalculateCoordinatesMode()
Gets a calculate coordinates mode as
CalculateCoordinatesModeEnumeration object. |
StyleSettings |
getChangedItemStyle()
Gets a style settings that will be applied to changed items.
|
ComparisonType |
getComparisonType()
Gets a type of source and target documents as
ComparisonType object so that Comparison will know how to compare them. |
StyleSettings |
getDeletedItemStyle()
Gets a style settings that will be applied to deleted items.
|
DetalisationLevel |
getDetalisationLevel()
Gets a level of comparison detalization represented as
DetalisationLevel. |
DiagramMasterSetting |
getDiagramMasterSetting()
Gets a setting of master page for Diagram documents represented by
DiagramMasterSetting object. |
com.groupdocs.comparison.options.enums.FolderComparisonExtension |
getFolderComparisonExtension()
Gets the format of the resulting folder comparison file.
|
com.groupdocs.comparison.options.IgnoreChangeSensitivitySettings |
getIgnoreChangeSettings()
Get settings to ignore changes based on similarity.
|
com.groupdocs.comparison.options.enums.ImagesInheritance |
getImagesInheritanceMode()
Get a value indicating whether images inheritance mode
|
StyleSettings |
getInsertedItemStyle()
Gets a style settings that will be applied to inserted items.
|
OriginalSize |
getOriginalSize()
Gets an original sizes of compared documents represented by
OriginalSize object. |
PaperSize |
getPaperSize()
Gets a size of a paper in result document as
PaperSize object. |
PasswordSaveOption |
getPasswordSaveOption()
Gets a password save option represented by
PasswordSaveOption object. |
int |
getSensitivityOfComparison()
Gets a sensitivity of comparison.
|
Integer |
getSensitivityOfComparisonForTables()
Get a sensitivity of comparison for tables.
|
String |
getUserMasterPath()
Gets the path to the user master's template for Diagrams.
|
boolean |
isCalculateCoordinates()
Gets a flag that indicates whether to calculate coordinates for changed components.
|
boolean |
isCompareImagesPdf()
Get a value indicating whether to compare images.
|
boolean |
isDetectStyleChanges()
Gets a flag that indicates whether to detect style changes or not.
|
boolean |
isDirectoryCompare()
Returns a flag that indicates whether directory comparison is enabled.
|
boolean |
isExtendedSummaryPage()
Gets a flag that indicates whether to add extended file comparison information to the summary page or not.
|
boolean |
isGenerateSummaryPage()
Gets a flag that indicates whether to add summary page with detected changes statistics to resultant document or not.
|
boolean |
isHeaderFootersComparison()
Gets a flag that indicates whether to compare header/footer contents.
|
boolean |
isLeaveGaps()
Deprecated.
|
boolean |
isMarkChangedContent()
Gets a flag that indicates whether frames for shapes in Word Processing and for rectangles in Image documents will be used.
|
boolean |
isMarkNestedContent()
Gets a flag that indicates whether to mark the children of the deleted or inserted elements as deleted or inserted.
|
boolean |
isShowDeletedContent()
Gets a flag that indicates whether to show deleted components in resultant document or not.
|
boolean |
isShowInsertedContent()
Gets a flag that indicates whether to show inserted components in resultant document or not.
|
boolean |
isShowOnlyChanged()
Returns a boolean value that indicates whether only changed items should be displayed.
|
boolean |
isShowOnlySummaryPage()
Gets a flag that indicates whether to leave in the resulting document only a page with statistics of detected changes or not.
|
void |
setCalculateCoordinates(boolean value)
Sets a flag that indicates whether to calculate coordinates for changed components.
|
void |
setCalculateCoordinatesMode(CalculateCoordinatesModeEnumeration calculateCoordinatesMode)
Sets a calculate coordinates mode as
CalculateCoordinatesModeEnumeration object. |
void |
setChangedItemStyle(StyleSettings value)
Sets a style settings that will be applied to changed items.
|
void |
setCompareImagesPdf(boolean compareImagesPdf)
Set a value indicating whether to compare images.
|
void |
setComparisonType(ComparisonType comparisonType)
Sets a type of source and target documents as
ComparisonType object so that Comparison will know how to compare them. |
void |
setDeletedItemStyle(StyleSettings value)
Sets a style settings that will be applied to deleted items.
|
void |
setDetalisationLevel(DetalisationLevel value)
Sets a level of comparison detalization represented as
DetalisationLevel. |
void |
setDetectStyleChanges(boolean value)
Sets a flag that indicates whether to detect style changes or not.
|
void |
setDiagramMasterSetting(DiagramMasterSetting value)
Sets a setting of master page for Diagram documents represented by
DiagramMasterSetting object. |
void |
setDirectoryCompare(boolean directoryCompare)
Sets a flag that indicates whether directory comparison should be enabled.
|
void |
setExtendedSummaryPage(boolean value)
Sets a flag that indicates whether to add extended file comparison information to the summary page or not.
|
void |
setFolderComparisonExtension(com.groupdocs.comparison.options.enums.FolderComparisonExtension folderComparisonExtension)
Sets the format of the resulting folder comparison file.
|
void |
setGenerateSummaryPage(boolean value)
Sets a flag that indicates whether to add summary page with detected changes statistics to resultant document or not.
|
void |
setHeaderFootersComparison(boolean value)
Sets a flag that indicates whether to compare header/footer contents.
|
void |
setIgnoreChangeSettings(com.groupdocs.comparison.options.IgnoreChangeSensitivitySettings ignoreChangeSettings)
Sets settings to ignore changes based on similarity.
|
void |
setImagesInheritanceMode(com.groupdocs.comparison.options.enums.ImagesInheritance imagesInheritanceMode)
Set a value indicating whether to images inheritance mode.
|
void |
setInsertedItemStyle(StyleSettings value)
Sets a style settings that will be applied to inserted items.
|
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.
|
void |
setMarkNestedContent(boolean value)
Sets a flag that indicates whether to mark the children of the deleted or inserted elements as deleted or inserted.
|
void |
setOriginalSize(OriginalSize value)
Sets an original sizes of compared documents represented by
OriginalSize object. |
void |
setPaperSize(PaperSize value)
Sets a size of a paper in result document as
PaperSize object. |
void |
setPasswordSaveOption(PasswordSaveOption value)
Sets a password save option represented by
PasswordSaveOption object. |
void |
setSensitivityOfComparison(int value)
Sets a sensitivity of comparison.
|
void |
setSensitivityOfComparisonForTables(Integer value)
Sets a sensitivity of comparison for tables.
|
void |
setShowDeletedContent(boolean value)
Sets a flag that indicates whether to show deleted components in resultant document or not.
|
void |
setShowInsertedContent(boolean value)
Sets a flag that indicates whether to show inserted components in resultant document or not.
|
void |
setShowOnlyChanged(boolean showOnlyChanged)
Sets the value indicating whether only changed items should be displayed.
|
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.
|
void |
setUserMasterPath(String userMasterPath)
Sets the path to the user master's template for Diagrams.
|
void |
setWordsSeparatorChars(char[] value)
Sets an array of delimiters which will be used to split text into words.
|
public com.groupdocs.comparison.options.IgnoreChangeSensitivitySettings ignoreChangeSettings
public CompareOptions()
Initializes a new instance of the CompareOptions class.
public CompareOptions(StyleSettings insertedItemStyle, StyleSettings deletedItemStyle, StyleSettings changedItemStyle)
Initializes a new instance of the CompareOptions class with settings for different styles.
insertedItemStyle - Style settings for inserted itemsdeletedItemStyle - Style settings for deleted itemschangedItemStyle - Style settings for changed style itemspublic CalculateCoordinatesModeEnumeration getCalculateCoordinatesMode()
Gets a calculate coordinates mode as CalculateCoordinatesModeEnumeration object.
public final StyleSettings getChangedItemStyle()
Gets a style settings that will be applied to changed items.
public ComparisonType getComparisonType()
Gets a type of source and target documents as ComparisonType object so that Comparison will know how to compare them.
LoadOptions.getFileType() option will be omitted.public final StyleSettings getDeletedItemStyle()
Gets a style settings that will be applied to deleted items.
public final DetalisationLevel getDetalisationLevel()
Gets a level of comparison detalization represented as DetalisationLevel.
DetalisationLevel.LOW.public final DiagramMasterSetting getDiagramMasterSetting()
Gets a setting of master page for Diagram documents represented by DiagramMasterSetting object.
public com.groupdocs.comparison.options.enums.FolderComparisonExtension getFolderComparisonExtension()
Gets the format of the resulting folder comparison file.
public com.groupdocs.comparison.options.IgnoreChangeSensitivitySettings getIgnoreChangeSettings()
Get settings to ignore changes based on similarity.
public com.groupdocs.comparison.options.enums.ImagesInheritance getImagesInheritanceMode()
Get a value indicating whether images inheritance mode
public final StyleSettings getInsertedItemStyle()
Gets a style settings that will be applied to inserted items.
public final OriginalSize getOriginalSize()
Gets an original sizes of compared documents represented by OriginalSize object.
public final PaperSize getPaperSize()
Gets a size of a paper in result document as PaperSize object.
public final PasswordSaveOption getPasswordSaveOption()
Gets a password save option represented by PasswordSaveOption object.
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.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.public String getUserMasterPath()
Gets the path to the user master's template for Diagrams.
public final boolean isCalculateCoordinates()
Gets a flag that indicates whether to calculate coordinates for changed components.
public boolean isCompareImagesPdf()
Get a value indicating whether to compare images.
public final boolean isDetectStyleChanges()
Gets a flag that indicates whether to detect style changes or not.
public boolean isDirectoryCompare()
Returns a flag that indicates whether directory comparison is enabled.
public boolean isExtendedSummaryPage()
Gets a flag that indicates whether to add extended file comparison information to the summary page or not.
public final boolean isGenerateSummaryPage()
Gets a flag that indicates whether to add summary page with detected changes statistics to resultant document or not.
public final boolean isHeaderFootersComparison()
Gets a flag that indicates whether to compare header/footer contents.
@Deprecated 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 withisShowInsertedContent() or isShowDeletedContent() properties.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.
public final boolean isMarkNestedContent()
Gets a flag that indicates whether to mark the children of the deleted or inserted elements as deleted or inserted.
public final boolean isShowDeletedContent()
Gets a flag that indicates whether to show deleted components in resultant document or not.
public final boolean isShowInsertedContent()
Gets a flag that indicates whether to show inserted components in resultant document or not.
public boolean isShowOnlyChanged()
Returns a boolean value that indicates whether only changed items should be displayed.
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.
public final void setCalculateCoordinates(boolean value)
Sets a flag that indicates whether to calculate coordinates for changed components.
value - true if coordinates for changed components should be calculated, otherwise falsepublic void setCalculateCoordinatesMode(CalculateCoordinatesModeEnumeration calculateCoordinatesMode)
Sets a calculate coordinates mode as CalculateCoordinatesModeEnumeration object.
calculateCoordinatesMode - The calculate coordinates modepublic final void setChangedItemStyle(StyleSettings value)
Sets a style settings that will be applied to changed items.
value - Style settings of changed itemsIllegalArgumentException - if value is nullpublic void setCompareImagesPdf(boolean compareImagesPdf)
Set a value indicating whether to compare images.
compareImagesPdf - Compare imagesIllegalArgumentException - if value is nullpublic void setComparisonType(ComparisonType comparisonType)
Sets a type of source and target documents as ComparisonType object so that Comparison will know how to compare them.
LoadOptions.setFileType(FileType) option will be omitted.comparisonType - The type of source and target documentspublic final void setDeletedItemStyle(StyleSettings value)
Sets a style settings that will be applied to deleted items.
value - Style settings of deleted itemsIllegalArgumentException - if value is nullpublic final void setDetalisationLevel(DetalisationLevel value)
Sets a level of comparison detalization represented as DetalisationLevel.
DetalisationLevel.LOWvalue - The level of comparison detalizationIllegalArgumentException - if value is nullpublic final void setDetectStyleChanges(boolean value)
Sets a flag that indicates whether to detect style changes or not.
value - true if style changes should be detected, otherwise falsepublic final void setDiagramMasterSetting(DiagramMasterSetting value)
Sets a setting of master page for Diagram documents represented by DiagramMasterSetting object.
value - The diagram master page settingIllegalArgumentException - if value is nullpublic void setDirectoryCompare(boolean directoryCompare)
Sets a flag that indicates whether directory comparison should be enabled.
directoryCompare - true if directory comparison should be enabled, otherwise falsepublic void setExtendedSummaryPage(boolean value)
Sets a flag that indicates whether to add extended file comparison information to the summary page or not.
value - true if extended file comparison information should be added to summary page, otherwise falsepublic void setFolderComparisonExtension(com.groupdocs.comparison.options.enums.FolderComparisonExtension folderComparisonExtension)
folderComparisonExtension - the FolderComparisonExtension representing the format of the resulting folder comparison filepublic final void setGenerateSummaryPage(boolean value)
Sets a flag that indicates whether to add summary page with detected changes statistics to resultant document or not.
value - true if summary page should be added, otherwise falsepublic final void setHeaderFootersComparison(boolean value)
Sets a flag that indicates whether to compare header/footer contents.
value - true if header/footer contents should be compared, otherwise falsepublic void setIgnoreChangeSettings(com.groupdocs.comparison.options.IgnoreChangeSensitivitySettings ignoreChangeSettings)
Sets settings to ignore changes based on similarity.
ignoreChangeSettings - Settings to ignore changes.public void setImagesInheritanceMode(com.groupdocs.comparison.options.enums.ImagesInheritance imagesInheritanceMode)
Set a value indicating whether to images inheritance mode.
imagesInheritanceMode - Images inheritance modeIllegalArgumentException - if value is nullpublic final void setInsertedItemStyle(StyleSettings value)
Sets a style settings that will be applied to inserted items.
value - Style settings of inserted itemsIllegalArgumentException - if value is nullpublic 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.
value - true if frames should be used, otherwise falsepublic 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.
value - true if the children of the deleted or inserted elements should be marked as deleted or inserted, otherwise falsepublic final void setOriginalSize(OriginalSize value)
Sets an original sizes of compared documents represented by OriginalSize object.
value - The original size of documentsIllegalArgumentException - if value is nullpublic final void setPaperSize(PaperSize value)
Sets a size of a paper in result document as PaperSize object.
value - The size of a paper in result documentpublic final void setPasswordSaveOption(PasswordSaveOption value)
Sets a password save option represented by PasswordSaveOption object.
value - The password save optionIllegalArgumentException - if value is nullpublic 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.value - The sensitivity of comparisonpublic 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.value - The sensitivity of comparison for tablespublic final void setShowDeletedContent(boolean value)
Sets a flag that indicates whether to show deleted components in resultant document or not.
value - true if deleted components in resultant document should be shown, otherwise falsepublic final void setShowInsertedContent(boolean value)
Sets a flag that indicates whether to show inserted components in resultant document or not.
value - true if inserted components in resultant document should be shown, otherwise falsepublic void setShowOnlyChanged(boolean showOnlyChanged)
Sets the value indicating whether only changed items should be displayed.
showOnlyChanged - the boolean value indicating whether only changed items should be displayedpublic 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.
value - true if in the resulting document only a page with statistics of detected changes should be left, otherwise falsepublic void setUserMasterPath(String userMasterPath)
Sets the path to the user master's template for Diagrams.
userMasterPath - The path to the user master's template for Diagrams.public final void setWordsSeparatorChars(char[] value)
Sets an array of delimiters which will be used to split text into words.
value - The array of delimiters to split text into wordsIllegalArgumentException - if value is nullCopyright © 2026. All rights reserved.