Open GoogleCodeExporter opened 9 years ago
Please your kind help.
Original comment by rramos0...@gmail.com
on 23 Feb 2015 at 7:57
This is a very old post. But still in 2020 i faced the same issue and i struggled to find a single answer. Hence thought of posting so that someone might get benefit.
I did a reverse engineer by going into the 3rd party jar where this error was occurring and added the "food" in respective Word document generator code that solved the pdf converter's hunger. :-)
Surprisingly, this issue was shown only to the word document that was created using Apache POI...! If you try to use a word document that was created using MS Office, there wont be any issue.. :-)
So, while we create table in a word document via POI, we need to add a line immediately after the createTable() statement
XWPFTable table = outputDoc.createTable(); table.getCTTbl().addNewTblGrid();
Hi, I am facing the same issue. But in my case I am using only paragraphs and images. Were you able to find the solution in those cases.
fr.opensagres.poi.xwpf.converter.core.XWPFConverterException: java.lang.IllegalStateException: Expecting one Styles document part, but found 0
at fr.opensagres.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:71)
at fr.opensagres.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:39)
at fr.opensagres.poi.xwpf.converter.core.AbstractXWPFConverter.convert(AbstractXWPFConverter.java:46)
at utility.PDFHandle.generatePDF(PDFHandle.java:35)
at utility.Reporter.saveReport(Reporter.java:83)
at tests.TC001_ApplicationLogInAndInitiateSIP_Temp.resetConfig(TC001_ApplicationLogInAndInitiateSIP_Temp.java:55)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:62)
at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:385)
at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:321)
at org.testng.TestRunner.invokeTestConfigurations(TestRunner.java:637)
at org.testng.TestRunner.afterRun(TestRunner.java:877)
at org.testng.TestRunner.run(TestRunner.java:599)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:377)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:371)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:332)
at org.testng.SuiteRunner.run(SuiteRunner.java:276)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1134)
at org.testng.TestNG.runSuites(TestNG.java:1063)
at org.testng.TestNG.run(TestNG.java:1031)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: java.lang.IllegalStateException: Expecting one Styles document part, but found 0
at org.apache.poi.xwpf.usermodel.XWPFDocument.getStyle(XWPFDocument.java:547)
at fr.opensagres.poi.xwpf.converter.core.styles.XWPFStylesDocument.
This is the complete error I am getting
Try upgrading to latest poi versions and see. Else, as i have mentioned above, you need to decompile the poi jar file and look at PdfConverter.java:71 to see why that error is occurring. Then find the function in poi that supplies that required item and use it (Sadly, not an easy task. but no other go)
Original issue reported on code.google.com by
rramos0...@gmail.com
on 23 Feb 2015 at 7:56