poi中没有xhtmloptions和Converter,自己下了jar之后还报错,怎么回事呢?

qq_33431542 2016-06-16 11:20:41
最近在做docx转html:
InputStream in= new FileInputStream(new File("e:/2016年第2期.docx"));
XWPFDocument document = new XWPFDocument(in);

XHTMLOptions options = XHTMLOptions.create().URIResolver(new FileURIResolver(new File("e:/abc.html")));
OutputStream out = new ByteArrayOutputStream();
XHTMLConverter.getInstance().convert(document, out, options);
String html=out.toString();
System.out.println(html);


报错:
Exception in thread "main" java.lang.NoClassDefFoundError: org/openxmlformats/schemas/wordprocessingml/x2006/main/FontsDocument$Factory
at org.apache.poi.xwpf.converter.core.styles.XWPFStylesDocument.getFontsDocument(XWPFStylesDocument.java:1488)
at org.apache.poi.xwpf.converter.core.styles.XWPFStylesDocument.<init>(XWPFStylesDocument.java:192)
at org.apache.poi.xwpf.converter.xhtml.internal.styles.CSSStylesDocument.<init>(CSSStylesDocument.java:100)
at org.apache.poi.xwpf.converter.xhtml.internal.XHTMLMapper.createStylesDocument(XHTMLMapper.java:131)
at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.<init>(XWPFDocumentVisitor.java:154)
at org.apache.poi.xwpf.converter.xhtml.internal.XHTMLMapper.<init>(XHTMLMapper.java:121)
at org.apache.poi.xwpf.converter.xhtml.XHTMLConverter.convert(XHTMLConverter.java:72)
at org.apache.poi.xwpf.converter.xhtml.XHTMLConverter.doConvert(XHTMLConverter.java:63)
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 test.test.main(test.java:23)
Caused by: java.lang.ClassNotFoundException: org.openxmlformats.schemas.wordprocessingml.x2006.main.FontsDocument$Factory
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 11 more

这两个类百度上也没找到。如果有这两个类的话就能实现docx转html了吗?如果这条路不通还有别的办法吗?
...全文
1754 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_33431542 2016-06-17
  • 打赏
  • 举报
回复
楼上的大神~~h用poi把docx转成html都需要哪些包呢~~~
家里敷泥呀 2016-06-16
  • 打赏
  • 举报
回复
Caused by: java.lang.ClassNotFoundException: org.openxmlformats.schemas.wordprocessingml.x2006.main.FontsDocument$Factory 很明显,缺少jar啊。

51,400

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧