com.aspose.words

Class CompareOptions

  • java.lang.Object
    • com.aspose.words.CompareOptions
public class CompareOptions 
extends java.lang.Object

Allows to choose advanced options for document comparison operation.

Constructor Summary
 
Property Getters/Setters Summary
booleangetIgnoreCaseChanges()
void
setIgnoreCaseChanges(booleanvalue)
           True indicates that documents comparison is case insensitive. By default comparison is case sensitive.
booleangetIgnoreComments()
void
setIgnoreComments(booleanvalue)
           Specifies whether to compare differences in comments. By default comments are not ignored.
booleangetIgnoreFields()
void
setIgnoreFields(booleanvalue)
           Specifies whether to compare differences in fields. By default fields are not ignored.
booleangetIgnoreFootnotes()
void
setIgnoreFootnotes(booleanvalue)
           Specifies whether to compare differences in footnotes and endnotes. By default footnotes are not ignored.
booleangetIgnoreFormatting()
void
setIgnoreFormatting(booleanvalue)
           True indicates that formatting is ignored. By default document formatting is not ignored.
booleangetIgnoreHeadersAndFooters()
void
           True indicates that headers and footers content is ignored. By default headers and footers are not ignored.
booleangetIgnoreTables()
void
setIgnoreTables(booleanvalue)
           Specifies whether to compare the differences in data contained in tables. By default tables are not ignored.
booleangetIgnoreTextboxes()
void
setIgnoreTextboxes(booleanvalue)
           Specifies whether to compare differences in the data contained within text boxes. By default textboxes are not ignored.
intgetTarget()
void
setTarget(intvalue)
           Specifies which document shall be used as a target during comparison. The value of the property is ComparisonTargetType integer constant.
 

    • Constructor Detail

      • CompareOptions

        public CompareOptions()
    • Property Getters/Setters Detail

      • getIgnoreCaseChanges/setIgnoreCaseChanges

        public boolean getIgnoreCaseChanges() / public void setIgnoreCaseChanges(boolean value)
        
        True indicates that documents comparison is case insensitive. By default comparison is case sensitive.
      • getIgnoreComments/setIgnoreComments

        public boolean getIgnoreComments() / public void setIgnoreComments(boolean value)
        
        Specifies whether to compare differences in comments. By default comments are not ignored.
      • getIgnoreFields/setIgnoreFields

        public boolean getIgnoreFields() / public void setIgnoreFields(boolean value)
        
        Specifies whether to compare differences in fields. By default fields are not ignored.
      • getIgnoreFootnotes/setIgnoreFootnotes

        public boolean getIgnoreFootnotes() / public void setIgnoreFootnotes(boolean value)
        
        Specifies whether to compare differences in footnotes and endnotes. By default footnotes are not ignored.
      • getIgnoreFormatting/setIgnoreFormatting

        public boolean getIgnoreFormatting() / public void setIgnoreFormatting(boolean value)
        
        True indicates that formatting is ignored. By default document formatting is not ignored.

        Example:

        Shows how to specify which document shall be used as a target during comparison
        Document doc1 = new Document(getMyDir() + "Document.CompareOptions.1.docx");
        Document doc2 = new Document(getMyDir() + "Document.CompareOptions.2.docx");
        
        //ComparisonTargetType with IgnoreFormatting setting determines which document has to be used as formatting source for ranges of equal text.
        CompareOptions compareOptions = new CompareOptions();
        compareOptions.setIgnoreFormatting(true);
        compareOptions.setTarget(ComparisonTargetType.NEW);
        
        doc1.compare(doc2, "vderyushev", new Date(), compareOptions);
        
        doc1.save(getMyDir() + "\\Artifacts\\Document.CompareOptions.docx");
      • getIgnoreHeadersAndFooters/setIgnoreHeadersAndFooters

        public boolean getIgnoreHeadersAndFooters() / public void setIgnoreHeadersAndFooters(boolean value)
        
        True indicates that headers and footers content is ignored. By default headers and footers are not ignored.
      • getIgnoreTables/setIgnoreTables

        public boolean getIgnoreTables() / public void setIgnoreTables(boolean value)
        
        Specifies whether to compare the differences in data contained in tables. By default tables are not ignored.
      • getIgnoreTextboxes/setIgnoreTextboxes

        public boolean getIgnoreTextboxes() / public void setIgnoreTextboxes(boolean value)
        
        Specifies whether to compare differences in the data contained within text boxes. By default textboxes are not ignored.
      • getTarget/setTarget

        public int getTarget() / public void setTarget(int value)
        
        Specifies which document shall be used as a target during comparison. The value of the property is ComparisonTargetType integer constant.

        Example:

        Shows how to specify which document shall be used as a target during comparison
        Document doc1 = new Document(getMyDir() + "Document.CompareOptions.1.docx");
        Document doc2 = new Document(getMyDir() + "Document.CompareOptions.2.docx");
        
        //ComparisonTargetType with IgnoreFormatting setting determines which document has to be used as formatting source for ranges of equal text.
        CompareOptions compareOptions = new CompareOptions();
        compareOptions.setIgnoreFormatting(true);
        compareOptions.setTarget(ComparisonTargetType.NEW);
        
        doc1.compare(doc2, "vderyushev", new Date(), compareOptions);
        
        doc1.save(getMyDir() + "\\Artifacts\\Document.CompareOptions.docx");