spire.office9.1.10
JDK1.8
进行word文档对比:
代码:
//载入原文档和修改后的文档
original.loadFromFile("模板合同.docx");
revised.loadFromFile("客户合同.docx");
CompareOptions options = new CompareOptions();
options.setTextCompareLevel(TextDiffMode.Char);
//比较两个文档
original.compare(revised, "user", new Date(), options);
//保存比较结果
original.saveToFile("对比结果.docx");
代码报错:
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Float
at com.spire.doc.packages.sprjdv.spr†※—(Unknown Source)
at com.spire.doc.packages.sprobw.spr‘∬—(Unknown Source)
at com.spire.doc.packages.sprobw.spr▎∬—(Unknown Source)
at com.spire.doc.packages.sprwnv.spr╻⁆—(Unknown Source)
at com.spire.doc.packages.sprwnv.spr┟▒(Unknown Source)
at com.spire.doc.documents.Paragraph.spr㈮⃞□(Unknown Source)
at com.spire.doc.DocumentObject.spr‰◐(Unknown Source)
at com.spire.doc.documents.Paragraph.spr╹◑(Unknown Source)
at com.spire.doc.DocumentObject.spr‣◑(Unknown Source)
at com.spire.doc.DocumentObject.spr‰◐(Unknown Source)
at com.spire.doc.Body.spr╹◑(Unknown Source)
at com.spire.doc.packages.sprwnv.spr┠⇇—(Unknown Source)
at com.spire.doc.packages.sprpiv.spr≂⁆—(Unknown Source)
at com.spire.doc.packages.sprpiv.spr—⇇—(Unknown Source)
at com.spire.doc.packages.sprwnv.spr∭┏(Unknown Source)
at com.spire.doc.packages.spriov.spr≂⁆—(Unknown Source)
at com.spire.doc.packages.spriov.spr®‘(Unknown Source)
at com.spire.doc.packages.spriov.spr⑊⇇—(Unknown Source)
at com.spire.doc.packages.spriov.spr¬⇇—(Unknown Source)
at com.spire.doc.Document.spr↮┐—(Unknown Source)
at com.spire.doc.Document.saveToFile(Unknown Source)
at com.spire.doc.Document.saveToFile(Unknown Source)
at org.example.Main.main(Main.java:36)