无法增加 Jasper 报告中的列 header 高度

Can't increase the column header height in a Jasper report

编译时出现如下错误:

[jrc] net.sf.jasperreports.engine.design.JRValidationException: Report design not valid :
  [jrc]      1. The title section, the page and column headers and footers and the margins do not fit the page height.
  [jrc]      2. The page and column headers and footers and the margins do not fit the page height.
  [jrc]      3. The page and column headers and footers and the margins do not fit the last page height.

问题出在以下报告中:

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ReturnDeliveryNoteColumnHeader" pageWidth="555" pageHeight="30" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenResourceMissingType="Empty" uuid="4328d8a4-e5d5-4d7d-9fba-b42407325799">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <columnHeader>
        <band height="30" splitType="Stretch"/>
    </columnHeader>
</jasperReport>

当带区高度增加到 30 以上时会出现问题。另一个报表将此报表用作页面 Header 带区中的子报表。我把Page Header band 的高度和Page Header 内的Subreport height 改成了50,还是报错。

将 splitType="Stretch" 更改为另一种方法可能是错误的,您使用了页面的最大大小

您的模板以

开头
<jasperReport ... pageHeight="30" ...>

因此,将列 header 带区的高度增加到 30 以上,使其不再适合页面。

如果您想要更高的范围,请使用足够大的页面高度来容纳该范围。