Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 表中嵌入的表导致;非法(超越边界/重叠)“;itext中的错误_Java_Itextsharp_Itext_Itextpdf - Fatal编程技术网

Java 表中嵌入的表导致;非法(超越边界/重叠)“;itext中的错误

Java 表中嵌入的表导致;非法(超越边界/重叠)“;itext中的错误,java,itextsharp,itext,itextpdf,Java,Itextsharp,Itext,Itextpdf,在生成PDF时,我在表中使用了表,得到了以下错误 com.ost.radhaz.struts.survey.action.PreviewSurveyAction caught an exception: com.lowagie.text.BadElementException com.lowagie.text.BadElementException: ***Adding a cell at the location (4,1) with a colspan of 1 and a rowspan

在生成PDF时,我在表中使用了表,得到了以下错误

com.ost.radhaz.struts.survey.action.PreviewSurveyAction caught an exception: com.lowagie.text.BadElementException

com.lowagie.text.BadElementException: ***Adding a cell at the location (4,1) with a colspan of 1 and a rowspan of 1 is illegal (beyond boundaries/overlapping).***
                at com.lowagie.text.Table.addCell(Unknown Source)
                at com.ost.radhaz.struts.survey.action.PreviewSurveyAction.generatePDFDocumentBytes(PreviewSurveyAction.java:882)
                at com.ost.radhaz.struts.survey.action.PreviewSurveyAction.execute(PreviewSurveyAction.java:81)
                at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
                at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
                at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
                at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
                at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
                at org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:182)
                at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:644)
                at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391)
                at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:908)
                at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)
                at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:226)
                at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:127)
                at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:116)
                at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
                at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
                at java.lang.Thread.run(Unknown Source)
我在网上查了一下,发现iText不再使用表格,他们建议使用PDFPTable。显然,对于在我的代码中使用table in table的代码量,我尝试只使用一块代码来测试PDFPtable是否生成PDF。显然不是,我能够克服上面的错误,但是我用来显示特定文本块的PDFPcell没有出现。它显示为空的。请告知

下面是我用于PDFPcell的代码

Phrase p2 = new Phrase("This is test phrase2", FontFactory.getFont(FontFactory.COURIER, 30, Font.NORMAL, new Color(255, 0, 0)));
PdfPCell test2 = new PdfPCell(p2);
optable.addCell(test2);
上面这个短语没有出现在我的PDF中,它显示为空,即使我已经生成了PDF


请注意,在我上面使用的代码块中,optable是PDFPtable,它再次嵌入到一个表中(不是PDFPtable)。

当我在某人的代码中看到我的名字时(我的名字是Lowagie),我知道:此人使用的是不受支持的过时版本的iText,并且此人收到答复的可能性非常低。您需要向我们提供更多信息。您正在使用哪个版本的iText?还请提供更多的代码,您还想做什么?表已经很长时间不受支持了。您可以尝试将您的PdfPTable添加到另一个PdfPTable中。但是将PdfPTable添加到PdfTable的结果是不可预测的。。。