【错误5】:The table width must be greater than zero.

使用itextpdf绘制表格,当表格的宽度使用百分比形式时(setWidthPercentage方法),setLockedWidth()方法不能设为true,否则会报The table width must be greater than zero.错误。解决方案,setLockedWidth()方法设为false,或者不使用该方法。

com.itextpdf.text.DocumentException: java.lang.RuntimeException: The table width must be greater than zero.
	at com.itextpdf.text.pdf.PdfDocument.add(PdfDocument.java:779)
	at com.itextpdf.text.Document.add(Document.java:278)
	at er.shenhua.app.quotamng.railway.demng.util.DeExportPdfImpl.deContentPage(DeExportPdfImpl.java:485)
	at er.shenhua.app.quotamng.railway.demng.util.DeExportPdfImpl.getPdfTable(DeExportPdfImpl.java:332)
	at er.shenhua.app.quotamng.railway.demng.rest.mng.DeInfoRest.pdfDeInfo(DeInfoRest.java:1434)
	at er.shenhua.app.quotamng.railway.demng.util.DeExportPdfImpl.printPdf(DeExportPdfImpl.java:119)
	at er.shenhua.app.quotamng.railway.demng.util.DeExportPdfImpl.printPdf(DeExportPdfImpl.java:122)
	at er.shenhua.app.quotamng.railway.demng.util.DeExportPdfImpl.printPdf(DeExportPdfImpl.java:122)
	at er.shenhua.app.quotamng.railway.demng.rest.mng.DeInfoRest.exportToPdf(DeInfoRest.java:1278)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171)
	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:406)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:350)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:106)
	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:259)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:319)
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:236)
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1028)
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:373)
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381)
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:344)
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:219)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:958)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: The table width must be greater than zero.
	at com.itextpdf.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:734)
	at com.itextpdf.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:896)
	at com.itextpdf.text.pdf.ColumnText.goComposite(ColumnText.java:1774)
	at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:882)
	at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:877)
	at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:866)
	at com.itextpdf.text.pdf.PdfDocument.addPTable(PdfDocument.java:2593)
	at com.itextpdf.text.pdf.PdfDocument.add(PdfDocument.java:728)
	... 53 more

【错误5】:The table width must be greater than zero._第1张图片

你可能感兴趣的:(错误收集)