public class ComparerContext extends ProcessorContext
Examples:
Shows how to simple compare documents using context.
// There is a several ways to compare documents:
String firstDoc = getMyDir() + "Table column bookmarks.docx";
String secondDoc = getMyDir() + "Table column bookmarks.doc";
ComparerContext comparerContext = new ComparerContext();
comparerContext.getCompareOptions().setIgnoreCaseChanges(true);
comparerContext.setAuthor("Author");
comparerContext.setDateTime(new Date());
Comparer.create(comparerContext)
.from(firstDoc)
.from(secondDoc)
.to(getArtifactsDir() + "LowCode.CompareContextDocuments.docx")
.execute();
Shows how to compare documents from the stream using context.
// There is a several ways to compare documents from the stream:
try (FileInputStream firstStreamIn = new FileInputStream(getMyDir() + "Table column bookmarks.docx")) {
try (FileInputStream secondStreamIn = new FileInputStream(getMyDir() + "Table column bookmarks.doc")) {
ComparerContext comparerContext = new ComparerContext();
comparerContext.getCompareOptions().setIgnoreCaseChanges(true);
comparerContext.setAuthor("Author");
comparerContext.setDateTime(new Date());
try (FileOutputStream streamOut = new FileOutputStream(getArtifactsDir() + "LowCode.CompareContextStreamDocuments.docx")) {
Comparer.create(comparerContext)
.from(firstStreamIn)
.from(secondStreamIn)
.to(streamOut, SaveFormat.DOCX)
.execute();
}
}
}
| Constructor and Description |
|---|
ComparerContext()
Initializes a new instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
getAcceptRevisions()
Indicates whether to accept revisions in the documents before comparing them.
|
java.lang.String |
getAuthor()
The author to be assigned to revisions created during document comparison.
|
CompareOptions |
getCompareOptions()
Options used upon comparing documents.
|
java.util.Date |
getDateTime()
The date and time assigned to revisions created during document comparison.
|
void |
setAcceptRevisions(boolean value)
Indicates whether to accept revisions in the documents before comparing them.
|
void |
setAuthor(java.lang.String value)
The author to be assigned to revisions created during document comparison.
|
void |
setDateTime(java.util.Date value)
The date and time assigned to revisions created during document comparison.
|
getFontSettings, getLayoutOptions, getWarningCallback, setFontSettings, setWarningCallbackpublic ComparerContext()
public java.lang.String getAuthor()
String value.public void setAuthor(java.lang.String value)
value - The corresponding String value.public java.util.Date getDateTime()
Date value.public void setDateTime(java.util.Date value)
value - The corresponding Date value.public boolean getAcceptRevisions()
true.boolean value.public void setAcceptRevisions(boolean value)
true.value - The corresponding boolean value.public CompareOptions getCompareOptions()
Examples:
Shows how to simple compare documents using context.
// There is a several ways to compare documents:
String firstDoc = getMyDir() + "Table column bookmarks.docx";
String secondDoc = getMyDir() + "Table column bookmarks.doc";
ComparerContext comparerContext = new ComparerContext();
comparerContext.getCompareOptions().setIgnoreCaseChanges(true);
comparerContext.setAuthor("Author");
comparerContext.setDateTime(new Date());
Comparer.create(comparerContext)
.from(firstDoc)
.from(secondDoc)
.to(getArtifactsDir() + "LowCode.CompareContextDocuments.docx")
.execute();
Shows how to compare documents from the stream using context.
// There is a several ways to compare documents from the stream:
try (FileInputStream firstStreamIn = new FileInputStream(getMyDir() + "Table column bookmarks.docx")) {
try (FileInputStream secondStreamIn = new FileInputStream(getMyDir() + "Table column bookmarks.doc")) {
ComparerContext comparerContext = new ComparerContext();
comparerContext.getCompareOptions().setIgnoreCaseChanges(true);
comparerContext.setAuthor("Author");
comparerContext.setDateTime(new Date());
try (FileOutputStream streamOut = new FileOutputStream(getArtifactsDir() + "LowCode.CompareContextStreamDocuments.docx")) {
Comparer.create(comparerContext)
.from(firstStreamIn)
.from(secondStreamIn)
.to(streamOut, SaveFormat.DOCX)
.execute();
}
}
}
CompareOptions value.