为什么部分不适合页面高度? [英] Why does sections do not fit the page height?
问题描述
我正在处理一份需要附加到另一个报告的报告,以生成更大的报告,因此它只有标题,页脚和摘要部分。问题是我收到了编译错误,我不知道原因。这是我的 jrxml
文件(为了简洁省略了 ...
的部分):
<?xml version =1.0encoding =UTF-8?>
< jasperReport ... pageWidth =595pageHeight =842whenNoDataType =AllSectionsNoDetailcolumnWidth =469leftMargin =70rightMargin =56topMargin =130bottomMargin =56 isSummaryWithPageHeaderAndFooter =true...>
< property ... some properties ... />
< parameter ... />
< queryString language =SQL> ...< / queryString>
< field ... />
< variable> ...< / variable>
< background>
< band splitType =Stretch/>
< / background>
< title>
< band height =650splitType =Stretch> ...< / band>
< / title>
< pageFooter>
< band height =50> ...< / band>
< / pageFooter>
< summary>
< band height =451> ...< / band>
< / summary>
< / jasperReport>
尝试使用Jaspersoft Studio我收到错误但看不到痕迹,所以我做了一个Netbeans中的小程序和我得到的堆栈跟踪是:
线程mainnet.sf.jasperreports中的异常。 engine.design.JRValidationException:报表设计无效:
1.标题部分,页面和列页眉和页脚以及页边距不适合页面高度。
at net.sf.jasperreports.engine.design.JRAbstractCompiler.verifyDesign(JRAbstractCompiler.java:280)
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:152)
at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:357)
at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:273)
at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:232)
at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:542)
at ar.edu .unt.jasper.ReportCompilerAndExporter.main(ReportCompilerAndExporter.java:25)
我的代码中的行(堆栈跟踪中的最后一个是这样的:
String myReport = JasperCompileManager.compileReportToFile(myReport.jrxml);
(文件存在且路径正确)
我的第一个想法是 pageHeight - (topMargin + bottomMargin)< 650px
但事实证明并非如此,实际上是 656px
所以我不知道我错过了什么。欢迎任何帮助或指南。
我尝试删除< pageFooter>
仅用于测试(我不能在最终报告中执行,它包含一些信息)并且报告可以顺利编译和呈现。此外,我可以说没有任何元素在乐队之外,因为它是由Jaspersoft Studio制作的,并且在设计视图中显示了这种错误。
关于此的任何其他信息报告源代码请在评论中告诉我。
它试图在同一页面上同样适合 pageFooter
as title
band( 650 + 50> 656
)。
如果你喜欢在没有 pageFooter
的单独页面上的标题乐队,你需要设置属性
isTitleNewPage =true
来自
I'm working in a report which needs to be attached to another to generate a bigger report, so it only has title, page footer and summary sections. The problem is that I'm getting a compilation error and I don't know the reason. This is my jrxml
file (parts with ...
omitted for brevity):
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport ... pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="469" leftMargin="70" rightMargin="56" topMargin="130" bottomMargin="56" isSummaryWithPageHeaderAndFooter="true" ...>
<property ...some properties.../>
<parameter .../>
<queryString language="SQL">...</queryString>
<field .../>
<variable>...</variable>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="650" splitType="Stretch">...</band>
</title>
<pageFooter>
<band height="50">...</band>
</pageFooter>
<summary>
<band height="451">...</band>
</summary>
</jasperReport>
Trying with Jaspersoft Studio I was getting an error but couldn't see the trace, so I made a little routine in Netbeans and the stack trace I'm getting is:
Exception in thread "main" net.sf.jasperreports.engine.design.JRValidationException: Report design not valid :
1. The title section, the page and column headers and footers and the margins do not fit the page height.
at net.sf.jasperreports.engine.design.JRAbstractCompiler.verifyDesign(JRAbstractCompiler.java:280)
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:152)
at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:357)
at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:273)
at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:232)
at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:542)
at ar.edu.unt.jasper.ReportCompilerAndExporter.main(ReportCompilerAndExporter.java:25)
The line from my code (the last in the stack trace) is this:
String myReport = JasperCompileManager.compileReportToFile("myReport.jrxml");
(the file exists and the path is correct)
My first thought was that pageHeight - (topMargin + bottomMargin) < 650px
but it turns out that is not the case, in fact is 656px
so I don't know what I'm missing. Any help or guide is welcomed.
I tried removing <pageFooter>
just for test (I can't do it in the final report, it contains some info) and the report compiles and renders smoothly. Besides, I can say that no element is outside the band because it's made with Jaspersoft Studio and that kind of error is shown in the design view.
Any other info about the report source code please let me know in the comments.
It is trying to fit also the pageFooter
on the same page as title
band (650+50>656
).
If you like title band on a separate page without pageFooter
you need to set attribute
isTitleNewPage="true"
from JReport API
Specifies if the title section will be printed on a separate initial page.
In JasperSoft Studio
这篇关于为什么部分不适合页面高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!