Hi,
Sometimes when I compare .doc with .docx documents I get the following exception, do you have any ideas as to what can be causing this error?
I tried using aspose-words-16.2.0-jdk16.jar and aspose-words-16.3.0-jdk16.jar files but I get the same error
java.lang.IllegalStateException
at com.aspose.words.zzZWU.endElement(Unknown Source)
at com.aspose.words.zz0E.zzZYD(Unknown Source)
at com.aspose.words.zz0E.zzZYG(Unknown Source)
at com.aspose.words.zz0E.zzZYQ(Unknown Source)
at com.aspose.words.zzZW7.zzZ(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
Here is my code:
Document doc1 = new Document(file1Path);
doc1.save(diffFilePath+".htm", SaveFormat.HTML);
Document doc2 = new Document(file2Path);
doc2.save(diffFilePath +".htm", SaveFormat.HTML);
if(doc1.hasRevisions())
{
doc1.acceptAllRevisions();
}
if(doc2.hasRevisions())
{
doc2.acceptAllRevisions();
}
doc2.compare(doc1, “user”, new java.util.Date()); // doc1 now contains changes as revisions.
doc2.save(diffFilePath + “temp_diff.html”, SaveFormat.HTML);
Any help will be greatly appreciated
This issue keeps happening even after we got the latest version of the jar files, here are a couple documents that give this error when we compare them.
Document doc1 = new Document(file1Path + file1Name);
doc1.save(diffFilePath + File.separator + Utilities.getFilePrefix(file1Name)+".htm", SaveFormat.HTML);
Document doc2 = new Document(file2Path + file2Name);
doc2.save(diffFilePath + File.separator + Utilities.getFilePrefix(file2Name)+".htm", SaveFormat.HTML);
if(doc1.hasRevisions())
{
doc1.acceptAllRevisions();
}
if(doc2.hasRevisions())
{
doc2.acceptAllRevisions();
}
doc2.compare(doc1, “user”, new java.util.Date()); // doc1 now contains changes as revisions.
doc2.save(diffFilePath + File.separator + “temp_diff.html”, SaveFormat.HTML);
in this case doc1 is Consent_1792.rtf, doc2 is Consent_1791.rtf
the exception in line :
doc2.save(diffFilePath + File.separator + “temp_diff.html”, SaveFormat.HTML);
Hi Tahir,
Hi Tahir,
Hi Tahir,
Hi Dat Luu,
Thanks for your inquiry. Aspose.Words mimics the same behavior as MS Word does.
The color information of track changes is not stored in Word document and cannot be controlled by Aspose.Words. Please change the colors of track changes options in MS Word and check the input and output documents. See the attached images for detail.
If you still face any issue, please share complete detail of your use case along with expected output document. We will then provide you more information about your query.
Hi Tahir,
Hi Dat Luu,
Thanks for your inquiry. Please open the document generated by Aspose.Words in MS Word and check the output. You will see the same output.
mescobar:
Document doc1 = new Document(file1Path + file1Name);
doc1.save(diffFilePath + File.separator + Utilities.getFilePrefix(file1Name)+".htm", SaveFormat.HTML);
Document doc2 = new Document(file2Path + file2Name);
doc2.save(diffFilePath + File.separator + Utilities.getFilePrefix(file2Name)+".htm", SaveFormat.HTML);
if(doc1.hasRevisions())
{
doc1.acceptAllRevisions();
}
if(doc2.hasRevisions())
{
doc2.acceptAllRevisions();
}
doc2.compare(doc1, "user", new java.util.Date()); // doc1 now contains changes as revisions.
doc2.save(diffFilePath + File.separator + "temp_diff.html", SaveFormat.HTML);Hi Tahir,We are using code output, and save format is HTML.Thank you,Dat Luu
Hi Dat Luu,
Document doc1 = new Document(MyDir + “With+Header+document.docx”); <o:p></o:p>
Document doc2 = new Document(MyDir + "NoHeader+document.docx");
doc2.compare(doc1, "user", new java.util.Date());
RevisionOptions options = doc2.getLayoutOptions().getRevisionOptions();
options.setInsertedTextColor(RevisionColor.YELLOW);
options.setDeletedTextColor(RevisionColor.BLUE);
options.setInsertedTextEffect(RevisionTextEffect.UNDERLINE);
options.setDeletedTextEffect(RevisionTextEffect.STRIKE_THROUGH);
doc2.save(MyDir + "Out v16.8.0.html", SaveFormat.HTML_FIXED);
Hi Tahir,
The issues you have found earlier (filed as WORDSNET-14242) have been fixed in this Aspose.Words for .NET 17.8 update and this Aspose.Words for Java 17.8 update.