com.aspose.words

Class ComparisonTargetType

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

Utility class containing constants. Allows to specify base document which will be used during comparison. Default value is CURRENT.
Relates to Microsoft Word "Show changes in" option in "Compare Documents" dialog box.

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.setIgnoreCaseChanges(false);
compareOptions.setIgnoreComments(false);
compareOptions.setIgnoreTables(false);
compareOptions.setIgnoreFields(false);
compareOptions.setIgnoreFootnotes(false);
compareOptions.setIgnoreTextboxes(false);
compareOptions.setIgnoreHeadersAndFooters(false);
compareOptions.setTarget(ComparisonTargetType.NEW);

doc1.compare(doc2, "vderyushev", new Date(), compareOptions);

doc1.save(getArtifactsDir() + "Document.CompareOptions.docx");

Field Summary
static final intCURRENT = 0
This document is used as a base during comparison.
static final intNEW = 1
Other document is used as a base during comparison.
 

    • Field Detail

      • CURRENT = 0

        public static final int CURRENT
        This document is used as a base during comparison.
      • NEW = 1

        public static final int NEW
        Other document is used as a base during comparison.