JasperReport table element is empty if report uses CSV data adapter

28 Views Asked by At

Created report based on csv data adapter.

Added to report table element.

Table element uses Dataset (Dataset Run) which was created using main csv data adapter. Dataset property "Use a JRDatasource expression" is set to $P{REPORT_DATA_SOURCE} enter image description here

"Parameter Map" is set to $P{REPORT_PARAMETERS_MAP}

enter image description here.

Table element in Jrxml:

        <componentElement>
            <reportElement x="1420" y="20" width="250" height="50" uuid="0e621b52-2246-4e00-916c-4d0b91f0b727">
                <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
                <property name="com.jaspersoft.studio.table.style.table_header" value="Table 2_TH"/>
                <property name="com.jaspersoft.studio.table.style.column_header" value="Table 2_CH"/>
                <property name="com.jaspersoft.studio.table.style.detail" value="Table 2_TD"/>
                <property name="com.jaspersoft.studio.components.autoresize.proportional" value="true"/>
            </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">
                <datasetRun subDataset="SHAREHOLDER_STOCK_CATEGORY_DATASET" uuid="25d6de91-b664-49e2-b950-9ef0491cea72">
                    <parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression>
                    <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
                </datasetRun>
                <jr:column width="119" uuid="a8bbf8cd-009f-41f2-9993-afb9ce0ad1eb">
                    <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
                    <jr:groupFooter groupName="SHAREHOLDER_STOCK_CATEGORY_GROUP">
                        <jr:cell height="30" rowSpan="1">
                            <textField>
                                <reportElement x="0" y="0" width="119" height="30" backcolor="#FFFFFF" uuid="af6fa926-20a4-4bbe-8389-3c5fe94182a5"/>
                                <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>
                                <textElement textAlignment="Right">
                                    <font isBold="true"/>
                                </textElement>
                                <textFieldExpression><![CDATA[$F{SHAREHOLDER_STOCK_CATEGORY}]]></textFieldExpression>
                            </textField>
                        </jr:cell>
                    </jr:groupFooter>
                    <jr:detailCell height="20">
                        <textField>
                            <reportElement x="0" y="0" width="119" height="20" uuid="28889612-a9a0-42ca-b6d1-3a62338de5a8"/>
                            <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>
                            <textFieldExpression><![CDATA[$F{SHAREHOLDER_STOCK_CATEGORY}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:column width="131" uuid="092c0c0e-7220-4a04-aff9-e19cb74c1586">
                    <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
                    <jr:groupFooter groupName="SHAREHOLDER_STOCK_CATEGORY_GROUP">
                        <jr:cell height="30" rowSpan="1">
                            <textField>
                                <reportElement x="0" y="0" width="131" height="30" uuid="038cd67f-89ca-4917-b109-a69cb052c460"/>
                                <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>
                                <textElement textAlignment="Right">
                                    <font isBold="true"/>
                                </textElement>
                                <textFieldExpression><![CDATA[$V{SHAREHOLDER_STOCK_QUANTITY1}]]></textFieldExpression>
                            </textField>
                        </jr:cell>
                    </jr:groupFooter>
                    <jr:detailCell style="Table 2_TD" height="20">
                        <textField>
                            <reportElement mode="Transparent" x="0" y="0" width="131" height="20" uuid="45de8f2b-c8f1-4826-9e37-4a48928fae7c"/>
                            <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>
                            <textFieldExpression><![CDATA[$F{SHAREHOLDER_STOCK_QUANTITY}]]></textFieldExpression>
                        </textField>
                    </jr:detailCell>
                </jr:column>
                <jr:detail>
                    <printWhenExpression><![CDATA[1==0]]></printWhenExpression>
                </jr:detail>
            </jr:table>
        </componentElement>

When report runs in JasperReport Studio- table elements displays data perfectly fine enter image description here .

But when I try to print same jrxml using JRXlsxExporter to XLSX this table element is empty.

Any Ideas please how to fix this?

Use JasperStudio 6.18.1 JasperReports dependencies in project:

implementation group: 'net.sf.jasperreports', name: 'jasperreports', version: '6.18.1' implementation 'net.sf.jasperreports:jasperreports-annotation-processors:6.7.0'

0

There are 0 best solutions below