我能够通过以下过程获得带有多页报告的多行列标题:
- 将表格的列标题高度设置为 40 像素
- 第 1 列和第 2 列有一个单行标题,因此它们的文本框高度为 40 像素
- 下面的代码包含第 1 列“收集系统”的 xml,但为了便于阅读,第 2 列省略了)
- I 将 3-5 列分组
- columnGroup width="240"
- columnHeader height="40"
- textbox1 "分配生产": x="0" y="0" width="240" height="20"
- textbox2 "Gas MCF": x="0" y="20" width="80" height="20"
- textbox3 "石油": x="80" y="20" width="80" height="20"
- textbox3 "水": x="160" y="20" width="80" height="20"
第 1 列
<jr:column width="200" uuid="5255e943-4959-49c4-9f83-0c6567d56684">
<jr:groupFooter groupName="GatheringGroup_dsSixMonths">
<jr:cell style="Alternate_Row" height="20" rowSpan="1">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<textField isStretchWithOverflow="true" pattern="#,##0.00">
<reportElement x="0" y="0" width="200" height="20" uuid="78a4370a-8d3e-4bae-9a58-47b5b947189c"/>
<textFieldExpression><![CDATA[$F{GatheringSystem.GatheringSystemName}]]></textFieldExpression>
</textField>
</jr:cell>
</jr:groupFooter>
<jr:columnHeader height="40" rowSpan="1">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<staticText>
<reportElement style="Crosstab_Header" x="0" y="0" width="200" height="40" uuid="9b4976a1-5deb-4edf-a4a7-39bd4375663d">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<text><![CDATA[Gathering System]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="0">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
</jr:detailCell>
</jr:column>
列 3-5 - 列组有 width="240" 像素
<jr:columnGroup width="240" uuid="dc55dcaa-91d3-4450-9300-3aaea94c789a">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Columns [3]"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<jr:columnHeader style="Table 1_CH" height="40">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
第一个文本框“Allocated Production”有 height="20"px, width="240"
<staticText>
<reportElement style="Crosstab_Header" x="0" y="0" width="240" height="20" uuid="1308d33c-05c3-4a0b-8fb3-6247693a95b6">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<text><![CDATA[Allocated Production]]></text>
</staticText>
第二个文本框“Gas MCF”有 height="20"px, width="80", 位于 x=0, y=20
<staticText>
<reportElement style="Crosstab_Header" x="0" y="20" width="80" height="20" uuid="3b3cacbb-232c-4a5c-afd7-e069213d6eac">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<text><![CDATA[Gas MCF]]></text>
</staticText>
第三个文本框“Oil”位于 x=80, y=20
<staticText>
<reportElement style="Crosstab_Header" x="80" y="20" width="80" height="20" uuid="6fd8d11e-b10c-4530-aaa7-2b2066ddc1de">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<text><![CDATA[Oil]]></text>
</staticText>
最后一个文本框“水”位于 x=160, y=20
<staticText>
<reportElement style="Crosstab_Header" x="160" y="20" width="80" height="20" uuid="4402b753-1d83-4e19-9467-47c6d5d7b173">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
</reportElement>
<text><![CDATA[Water]]></text>
</staticText>
</jr:columnHeader>