org.apache.poi.xwpf.converter.core.XWPFConverterException: java.lang.IllegalStateException: Expecting one Styles document part, but found 0
我在代码中添加了样式。但随后会出现以下错误:
我还得到了一个与头相关的空指针异常,错误如下:错误代码
org.apache.poi.xwpf.converter.core.XWPFConverterException: java.lang.NullPointerException
at org.apache.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:70) ~[org.apache.poi.xwpf.converter.pdf-1.0.6.jar:1.0.6]
at org.apache.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:38) ~[org.apache.poi.xwpf.converter.pdf-1.0.6.jar:1.0.6]
at org.apache.poi.xwpf.converter.core.AbstractXWPFConverter.convert(AbstractXWPFConverter.java:45) ~[org.apache.poi.xwpf.converter.core-1.0.6.jar:1.0.6]
at com.imviewer.report.DocxReportBuilder311CUSTOM.ConvertToPDF(DocxReportBuilder311CUSTOM.java:878) [classes/:na]
at com.imviewer.report.DocxReportBuilder311CUSTOM.doInBackground(DocxReportBuilder311CUSTOM.java:833) [classes/:na]
at com.imviewer.report.DocxReportBuilder311CUSTOM.doInBackground(DocxReportBuilder311CUSTOM.java:1) [classes/:na]
at javax.swing.SwingWorker$1.call(Unknown Source) [na:1.8.0_161]
at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.8.0_161]
at javax.swing.SwingWorker.run(Unknown Source) [na:1.8.0_161]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_161]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_161]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_161]
Caused by: java.lang.NullPointerException: null
at org.apache.poi.xwpf.converter.core.utils.XWPFTableUtil.getGridColList(XWPFTableUtil.java:183) ~[org.apache.poi.xwpf.converter.core-1.0.6.jar:1.0.6]
at org.apache.poi.xwpf.converter.core.utils.XWPFTableUtil.computeColWidths(XWPFTableUtil.java:116) ~[org.apache.poi.xwpf.converter.core-1.0.6.jar:1.0.6]
at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.visitTable(XWPFDocumentVisitor.java:867) ~[org.apache.poi.xwpf.converter.core-1.0.6.jar:1.0.6]
at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.visitBodyElements(XWPFDocumentVisitor.java:251) ~[org.apache.poi.xwpf.converter.core-1.0.6.jar:1.0.6]
at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.start(XWPFDocumentVisitor.java:199) ~[org.apache.poi.xwpf.converter.core-1.0.6.jar:1.0.6]
at org.apache.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:56) ~[org.apache.poi.xwpf.converter.pdf-1.0.6.jar:1.0.6]
... 11 common frames omitted