0
如何使用Apache Poi获取DOC文档中的页数?Apache Poi:在DOC文档中获取页数
我尝试使用下面的代码:
HWPFDocument wordDoc = new HWPFDocument(new FileInputStream(lowerFilePath));
Integer pageCount = wordDoc.getSummaryInformation().getPageCount();
但有例外(Apache的POI的版本:3.13)
java.lang.NoSuchMethodError: org.apache.poi.util.IOUtils.toByteArray(Ljava/io/InputStream;I)[B
at org.apache.poi.hwpf.HWPFDocumentCore.verifyAndBuildPOIFS(HWPFDocumentCore.java:95)
at org.apache.poi.hwpf.HWPFDocument.<init>(HWPFDocument.java:174)
https://stackoverflow.com/questions/18231134/how-to-avoid-java-lang-nosuchmethoderror-org-apache-poi-util-ioutils-copyljava –
请参阅http://poi.apache.org/ faq.html#faq-N10006 - 你的班级路径上有旧版本的POI – Gagravarr