java中mypoiexception_java.lang.ClassNotFoundException: org.apache.poi.xwpf.usermodel.IRunBody

I am trying to convert docx to pdf using xdocreport but I end up with classnot found exception for the class IRunBody. My package 'org.apache.poi.xwpf.usermodel' doesnt seem to have this interface. I have all the required jars for this. poi, poi-ooxml, poi-ooxml-schemas and yet I am unable to get this class. Can anyone let me know what am I missing here? Any other jars that I need to add? Below is the code that I am runnig

XWPFDocument xwpfDoc = new XWPFDocument(new FileInputStream(fileName));

PdfOptions options = PdfOptions.create().fontEncoding("windows-1250");

String randomFilename = UUID.randomUUID().toString();

String outputFIlePath = TEMPORARY_PDF_FILE_LOCATION + randomFilename + ".pdf";

OutputStream output = new FileOutputStream(outputFIlePath);

PdfConverter.getInstance().convert(xwpfDoc, output, options);

java

apache-poi

xdocreport

|

this question

edited Aug 10 '15 at 14:42

f_puras 2,123 4 16 32 asked Aug 10 '15 at 12:08

Crane 76 7      Have you made sure that you're using the latest version of Apache POI, and that you don't have any older POI jars on your classpath? See the

POI FAQ if you need help checking –

Gagravarr Aug 10 '15 at 12:53      Thanks for the suggestion! My ooxml jar was not latest. After updating this all is working well. –

Crane Aug 10 '15 at 17:53

|

2 Answers

2

My ooxml jar was not latest. After updating ooxml jar, the issue was resolved. Thank you.

|

this answer answered Aug 10 '15 at 17:56

Crane 76 7

|

I had exactly same problem. And I resolved it!

Because my project is not Maven, I could not use nice Dependencies maven resolver - what I did is 1) just temporary I created new empty Maven project; 2) in pom.xml I add just these 3 required for my needs libraries:

fr.opensagres.xdocreport

org.apache.poi.xwpf.converter.core

1.0.5

fr.opensagres.xdocreport

org.apache.poi.xwpf.converter.pdf

1.0.5

fr.opensagres.xdocreport

org.apache.poi.xwpf.converter.xhtml

1.0.5

3) Updated this Maven project, so it downloaded all these libraries and all of its dependencies, so I have got this jars:le. it does not show error when complied. but when it runs, it will throw RuntimeException at my MainApplication() class. while it gives that java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook I have a MainApplication clas

4) Then just copied these jars to my real project and it worked!

I recommend you to do same thing, instead of trying to solve dependencies manually.

|

this answer answered Jun 30 '16 at 18:22

Renat Gatin 639 6 24

|

primefaces dataexporter-button. I am using NetBeans 7.4, Mojarra 2.1.27, PrimeFaces 3.5 I also included apache poi-3.9 (also tried 3.7) which contains the RichTextString.class, so why does the Application not find it at runtime Any ideas

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值