Hello. I need to render compare result of two docx documents.
My code:
<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zz3.zzW(Unknown Source)
<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzZ12.zzZnH(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzYO.getWidth(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzYO.zzPE(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzYO.getX(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzYO.zzPE(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzYO.getX(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzYO.zzPE(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzYO.getX(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzYO.zzPE(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzX.zzZ(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzX.zzQ(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzW7.zzZ(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzZ4K.zzZ(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzXJ.zzvV(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzXJ.zzY(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzZD5.zzZCR(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzZD5.zzU(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzZCM.zzx(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzZ2N.zzS7(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzBA.zzXG(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzBB.zza8(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzZQV.zzZ(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.Document.updatePageLayout(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.Document.zzXI(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.Document.zzaQ(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzZX6.zzZ(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzZZY.zzZXy(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzZZY.zzZXH(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzZZY.zzZM(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzZZN.zzZJ(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.Node.toString(Unknown Source)<div style=“font-family: “Times New Roman”; white-space: normal;”><i style=“font-family: “Courier New”;”>
<i style=“font-family: “Courier New”;”>Document sourceDoc = new Document(“sourceDoc1.docx”);
<pre style=“font-family: “Courier New”; background-color: rgb(255, 255, 255);”>Document importDoc = new Document(“importDoc.docx”);<pre style=“font-family: “Courier New”; background-color: rgb(255, 255, 255);”>
<i style=“font-family: “Courier New”;”>Document copyOrigin = (Document) sourceDoc.deepClone(true);
<pre style=“font-family: “Courier New”; background-color: rgb(255, 255, 255);”>NodeCollection copyOriginNodes = copyOrigin.getFirstSection().getBody().getChildNodes();
sourceDoc.acceptAllRevisions();
importDoc.acceptAllRevisions();
sourceDoc.compare(importDoc, “AAA”, new Date());
Document copyAfterCompare = (Document) sourceDoc.deepClone(true);
Body bodyAfterCompare = copyAfterCompare.getFirstSection().getBody();
Node[] arrayNodeCopy = bodyAfterCompare.getChildNodes().toArray();
for (Node node : bodyAfterCompare.getChildNodes().toArray()){
node.toString(SaveFormat.HTML);
}<pre style=“font-family: “Courier New”; background-color: rgb(255, 255, 255);”>
<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzX.zzZ(Unknown Source)
sourceDoc.acceptAllRevisions();
importDoc.acceptAllRevisions();
sourceDoc.compare(importDoc, “AAA”, new Date());
Document copyAfterCompare = (Document) sourceDoc.deepClone(true);
Body bodyAfterCompare = copyAfterCompare.getFirstSection().getBody();
Node[] arrayNodeCopy = bodyAfterCompare.getChildNodes().toArray();
for (Node node : bodyAfterCompare.getChildNodes().toArray()){
node.toString(SaveFormat.HTML);
}<pre style=“font-family: “Courier New”; background-color: rgb(255, 255, 255);”>
node.toString throws follwing exception:
<div style=“font-family: “Times New Roman”; white-space: normal;”>java.lang.ArrayIndexOutOfBoundsException: 3
<div style=“font-family: “Times New Roman”; white-space: normal;”> at com.aspose.words.zzX.zzZ(Unknown Source)
<span style=“font-family: “Times New Roman”; white-space: normal;”>Without sourceDoc.deepClone <span style=“font-family: “Times New Roman”; white-space: normal;”>it works fine
<span style=“font-family: “Times New Roman”; white-space: normal;”>Aspose version: 16.5.0