Я использую Jasper soft Studio 5.5.0 и библиотеку Jasper Reports 6.5.0.
У меня есть отчет и в разделе подробностей используется группа, первая запись в таблице заменяется последней страницей последней запись. В Detail Band либо мы пробовали использовать таблицу и поведение списков одинаково. Заголовок столбца - это поля * stati c, а столбцы сведений содержат значения, которые имеют динамический размер c, поэтому свойства задаются как: растянуть с переполнением.
Мы не можем использовать разделенный тип, но он не работает, и иногда он дает исключение нулевого указателя. Также нам нужен флажок растянуть с переполнением, чтобы показать все содержимое. (Поскольку данные в столбцах являются динамическими c.)
Чтобы очистить сценарий согласно данным на рисунке: Как в столбце (sr.No) - 15,16,17. На следующей странице строка 16 заменяется строкой 15. Это происходит, когда столбец содержит данные большого размера. Как показано ниже на изображении.
Образец JR XML ниже:
<?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="sdmsTaxInvoiceReport" pageWidth="695" pageHeight="983" columnWidth="675" leftMargin="10" rightMargin="10" topMargin="10" bottomMargin="10" isSummaryWithPageHeaderAndFooter="true" isFloatColumnFooter="true" uuid="c0e87f36-9a58-40f0-a151-aa86a777e139">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="TaxInvoiceReportDtlDataSet" uuid="170e4603-8a73-472f-9af1-97ee81370884">
<parameter name="Decimal_Qty" class="java.lang.String"/>
<parameter name="Decimal_Amt" class="java.lang.String"/>
<queryString language="SQL">
<![CDATA[]]>
</queryString>
<field name="itemDesc" class="java.lang.String"/>
</subDataset>
<parameter name="Decimal_Amt" class="java.lang.String"/>
<parameter name="Decimal_Qty" class="java.lang.String"/>
<queryString language="SQL">
<![CDATA[]]>
</queryString>
<field name="globalSdTaxInvPrintDtlDTOs" class="java.util.List"/>
<group name="Group1" footerPosition="StackAtBottom">
<groupHeader>
<band height="29">
<componentElement>
<reportElement x="0" y="0" width="90" height="29" uuid="302fa254-ed0e-4a26-a0f8-5b8008714eff">
</reportElement>
<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" whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="TaxInvoiceReportDtlDataSet" uuid="301bb7ca-89a4-4e79-b8b0-c0cfd724d39a">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{globalSdTaxInvPrintDtlDTOs})]]></dataSourceExpression>
</datasetRun>
<jr:column width="15" uuid="645ceb80-4906-4d23-ad7f-acccce08bfa2">
<jr:columnFooter height="1">
<line>
<reportElement x="0" y="0" width="15" height="1" uuid="c99fb857-d5d5-42f3-bc49-8d081145d0c7"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
</jr:columnFooter>
<jr:detailCell style="Table_TD" height="28">
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="15" height="28" uuid="a4768b81-44a8-4308-9a1d-904e6085d9a3"/>
<box topPadding="4">
<topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
<font size="8"/>
<paragraph leftIndent="4"/>
</textElement>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="75" uuid="58cd0afa-6dd9-4bee-acd3-68c45d7f134d">
<jr:columnFooter height="1"/>
<jr:detailCell style="Table_TD" height="28">
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="75" height="28" uuid="8b4dbef5-ec9f-42b6-917f-4ed93ab47c70"/>
<box topPadding="4">
<topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle" markup="none">
<font size="8"/>
<paragraph leftIndent="4"/>
</textElement>
<textFieldExpression><![CDATA[$F{itemDesc}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</groupHeader>
</group>
<group name="Group2"/>
</jasperReport>