报错信息如下:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.poi.xwpf.usermodel.XWPFHyperlinkRun.<init>(Lorg/openxmlformats/schemas/wordprocessingml/x2006/main/CTHyperlink;Lorg/openxmlformats/schemas/wordprocessingml/x2006/main/CTR;Lorg/apache/poi/xwpf/usermodel/XWPFParagraph;)V
at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.visitRun(XWPFDocumentVisitor.java:651)at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.visitRuns(XWPFDocumentVisitor.java:600)
at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.visitParagraphBody(XWPFDocumentVisitor.java:427)
at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.visitParagraph(XWPFDocumentVisitor.java:318)
at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.visitBodyElements(XWPFDocumentVisitor.java:233)
at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.start(XWPFDocumentVisitor.java:186)
at org.apache.poi.xwpf.converter.xhtml.XHTMLConverter.convert(XHTMLConverter.java:68)
at org.apache.poi.xwpf.converter.xhtml.XHTMLConverter.doConvert(XHTMLConverter.java:58)
at org.apache.poi.xwpf.converter.xhtml.XHTMLConverter.doConvert(XHTMLConverter.java:38)
at org.apache.poi.xwpf.converter.core.AbstractXWPFConverter.convert(AbstractXWPFConverter.java:45)
at mxl.open.com.poi.WordToHtmlUtils.Word2007ToHtml(WordToHtmlUtils.java:169)
at mxl.open.com.poi.WordToHtmlUtils.main(WordToHtmlUtils.java:178)
java poi word转html的时候,word里面有链接,然后解析的时候一直报错,使用的包是:
fr.opensagres.xdocreport.document-2.0.1.jar
ooxml-schemas-1.1.jar
org.apache.poi.xwpf.converter.core-1.0.0.jar
org.apache.poi.xwpf.converter.xhtml-1.0.0.jar
poi-3.10.1.jar
poi-ooxml-3.10.1.jar
poi-ooxml-schemas-3.10.1.jar
poi-scratchpad-3.9.jar
最终解决方法:把org.apache.poi.xwpf.converter.core-1.0.0.jar、org.apache.poi.xwpf.converter.xhtml-1.0.0.jar的版本提高到1.0.6就好了