2

我的问题是,如何在jrxml文件中为iReport中的表页脚列设置colspan值。

我必须使用iReport轻松创建我的PDF设计。我通过Tomcat从PHP发送字段和参数值。我不使用 Java 创建动态碧玉报告。

这意味着我必须从jrxml解决我的问题。

有可能做到吗?

4

2 回答 2

5

您不能这样做colspan,但您可以在 iReport 中对表格列进行分组(在表格页脚中选择多于 1 列)。然后删除页脚中各个列的单元格,并在页脚中为“组页眉”添加一个单元格。所有纯 iReport/JRXML。

用于分组表页脚的 iReport 检查器

于 2013-08-26T06:34:46.153 回答
0

xml的细节部分:

    <detail>
    <band height="43" splitType="Stretch">
        <textField>
            <reportElement x="0" y="0" width="344" height="20"/>
            <box>
                <bottomPen lineWidth="0.5"/>
            </box>
            <textElement verticalAlignment="Middle">
                <font isBold="true"/>
            </textElement>
            <textFieldExpression class="java.lang.String"><![CDATA[$F{data_title}]]></textFieldExpression>
        </textField>
        <componentElement>
            <reportElement key="table" x="0" y="20" width="802" height="20"/>
            <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                <datasetRun subDataset="details">
                    <datasetParameter name="credit">
                        <datasetParameterExpression><![CDATA[$F{credit}]]></datasetParameterExpression>
                    </datasetParameter>
                    <datasetParameter name="debit_gross_sum">
                        <datasetParameterExpression><![CDATA[$F{debit_gross_sum}]]></datasetParameterExpression>
                    </datasetParameter>
                    <datasetParameter name="debit_net_sum">
                        <datasetParameterExpression><![CDATA[$F{debit_net_sum}]]></datasetParameterExpression>
                    </datasetParameter>
                    <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRMapCollectionDataSource($F{details})]]></dataSourceExpression>
                </datasetRun>
                <jr:column width="12">
                    <jr:tableFooter height="15" rowSpan="1"/>
                    <jr:detailCell height="20" rowSpan="1"/>
                </jr:column>
                <jr:column width="48">
                    <jr:tableFooter height="15" rowSpan="1"/>
                    <jr:detailCell height="20" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="48" height="20"/>
                            <textElement>
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[$F{time}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="106">
                    <jr:tableFooter height="15" rowSpan="1"/>
                    <jr:detailCell height="20" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="106" height="20"/>
                            <textElement>
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[$F{description}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="130">
                    <jr:tableFooter height="15" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="130" height="15"/>
                            <box>
                                <bottomPen lineWidth="0.5"/>
                            </box>
                            <textElement>
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[""]]></textFieldExpression>
                        </textField>
                    </jr:tableFooter>
                    <jr:detailCell height="20" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="130" height="20"/>
                            <textElement>
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[$F{guest_name}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="48">
                    <jr:tableFooter height="15" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="48" height="15"/>
                            <box>
                                <bottomPen lineWidth="0.5"/>
                            </box>
                            <textElement>
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[""]]></textFieldExpression>
                        </textField>
                    </jr:tableFooter>
                    <jr:detailCell height="20" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="48" height="20"/>
                            <textElement>
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[$F{room}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="79">
                    <jr:tableFooter height="15" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="79" height="15"/>
                            <box>
                                <bottomPen lineWidth="0.5"/>
                            </box>
                            <textElement>
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[""]]></textFieldExpression>
                        </textField>
                    </jr:tableFooter>
                    <jr:detailCell height="20" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="79" height="20"/>
                            <textElement>
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[$F{cachier_user}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="77">
                    <jr:tableFooter height="15" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="77" height="15"/>
                            <box>
                                <bottomPen lineWidth="0.5"/>
                            </box>
                            <textElement>
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[""]]></textFieldExpression>
                        </textField>
                    </jr:tableFooter>
                    <jr:detailCell height="20" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="77" height="20"/>
                            <textElement>
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[$F{source_room}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="126">
                    <jr:tableFooter height="15" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="126" height="15"/>
                            <box>
                                <bottomPen lineWidth="0.5"/>
                            </box>
                            <textElement>
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[""]]></textFieldExpression>
                        </textField>
                    </jr:tableFooter>
                    <jr:detailCell height="20" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="126" height="20"/>
                            <textElement>
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[$F{source_guest_name}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="70">
                    <jr:tableFooter height="15" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="70" height="15"/>
                            <box rightPadding="0">
                                <topPen lineWidth="0.5"/>
                                <bottomPen lineWidth="0.5"/>
                            </box>
                            <textElement textAlignment="Right">
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[$P{debit_gross_sum}]]></textFieldExpression>
                        </textField>
                    </jr:tableFooter>
                    <jr:detailCell height="20" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="70" height="20"/>
                            <textElement textAlignment="Right">
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[$F{debit_gross}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="70">
                    <jr:tableFooter height="15" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="70" height="15"/>
                            <box rightPadding="0">
                                <topPen lineWidth="0.5"/>
                                <bottomPen lineWidth="0.5"/>
                            </box>
                            <textElement textAlignment="Right">
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[$P{debit_net_sum}]]></textFieldExpression>
                        </textField>
                    </jr:tableFooter>
                    <jr:detailCell height="20" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="70" height="20"/>
                            <textElement textAlignment="Right">
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[$F{debit_net}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="37">
                    <jr:tableFooter height="15" rowSpan="1">
                        <textField isBlankWhenNull="true">
                            <reportElement x="0" y="0" width="37" height="15"/>
                            <box>
                                <topPen lineWidth="0.5"/>
                                <bottomPen lineWidth="0.5"/>
                            </box>
                            <textElement textAlignment="Right" verticalAlignment="Top">
                                <font pdfEncoding="Cp1250"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[$P{credit}]]></textFieldExpression>
                        </textField>
                    </jr:tableFooter>
                    <jr:detailCell height="20" rowSpan="1"/>
                </jr:column>
            </jr:table>
        </componentElement>
    </band>
</detail>

我想从 tableFotter 3 关闭。单元格 4 单元格。

谢谢亚历克斯 K!

于 2013-01-18T09:21:55.360 回答