2

在我的报告中使用子报告时出现问题。我有一个查询,它只产生了一条记录。我已经安排了一条记录显示一页。

当有子报表时,它打印 2 页,其中第二页空白。我看到以下异常:

Apr 01, 2013 5:45:25 PM net.sf.jasperreports.view.JRViewer paintPage
SEVERE: Page paint error.
net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Image read failed.
    at net.sf.jasperreports.engine.export.draw.PrintDrawVisitor.visit(PrintDrawVisitor.java:143)
    at net.sf.jasperreports.engine.export.draw.PrintDrawVisitor.visit(PrintDrawVisitor.java:57)
    at net.sf.jasperreports.engine.fill.JRTemplatePrintImage.accept(JRTemplatePrintImage.java:442)
    at net.sf.jasperreports.engine.export.draw.FrameDrawer.draw(FrameDrawer.java:251)
    at net.sf.jasperreports.engine.export.draw.FrameDrawer.draw(FrameDrawer.java:199)
    at net.sf.jasperreports.engine.export.JRGraphics2DExporter.exportPage(JRGraphics2DExporter.java:273)
    at net.sf.jasperreports.engine.export.JRGraphics2DExporter.exportReportToGraphics2D(JRGraphics2DExporter.java:246)
    at net.sf.jasperreports.engine.export.JRGraphics2DExporter.exportReport(JRGraphics2DExporter.java:184)
    at net.sf.jasperreports.view.JRViewer.paintPage(JRViewer.java:2104)
    at net.sf.jasperreports.view.JRViewer$PageRenderer.paintComponent(JRViewer.java:2254)
    at javax.swing.JComponent.paint(JComponent.java:1054)
    at javax.swing.JComponent.paintChildren(JComponent.java:887)
    at javax.swing.JComponent.paint(JComponent.java:1063)
    at javax.swing.JComponent.paintChildren(JComponent.java:887)
    at javax.swing.JComponent.paint(JComponent.java:1063)
    at javax.swing.JComponent.paintChildren(JComponent.java:887)
    at javax.swing.JComponent.paint(JComponent.java:1063)
    at javax.swing.JComponent.paintChildren(JComponent.java:887)
    at javax.swing.JComponent.paint(JComponent.java:1063)
    at javax.swing.JViewport.paint(JViewport.java:731)
    at javax.swing.JComponent.paintChildren(JComponent.java:887)
    at javax.swing.JComponent.paint(JComponent.java:1063)
    at javax.swing.JComponent.paintChildren(JComponent.java:887)
    at javax.swing.JComponent.paint(JComponent.java:1063)
    at javax.swing.JComponent.paintToOffscreen(JComponent.java:5221)
    at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1512)
    at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1443)
    at javax.swing.RepaintManager.paint(RepaintManager.java:1236)
    at javax.swing.JComponent._paintImmediately(JComponent.java:5169)
    at javax.swing.JComponent.paintImmediately(JComponent.java:4980)
    at javax.swing.RepaintManager$3.run(RepaintManager.java:796)
    at javax.swing.RepaintManager$3.run(RepaintManager.java:784)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:784)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:757)
    at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:706)
    at javax.swing.RepaintManager.access$1000(RepaintManager.java:62)
    at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1651)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:697)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

我一直在寻找上述问题,如 InputStream 或没有图像。而上述异常是因为出现的第二页。没想到第二页在哪里。

在子报表中,我制作了 2 列来显示图像,并将其放在 pageHeader 和 columnHeader 带上。所以有4张图片,pageHeader中有2张,columnHeader中有2张。

有什么建议么?请帮忙,谢谢。

4

2 回答 2

1

检查图像上的缓存属性。isUsingCache="true"为我解决了这个问题。

于 2013-06-25T13:37:22.897 回答
0

检查图像的大小,并检查 pageHeader 和 columnHeader 带的高度。

于 2013-04-01T11:08:14.573 回答