Search code examples
jasper-reports

Jasper Report: appear extra empty column in the end of table column


I am using jaspersoft studio 5.6.0. I created a table in summary band to display data from database. it generate extra empty column in the end of table. can anybody help me on this problem?

result in word:

enter image description here

jrxml


Solution

  • As @Fabio Fantoni said in the comments, you need to make sure that your table width and column width match up.

    Your tables widths do not match up with the width of the columns inside them (some by just a single pixel), this is probably causing the issue.

    Here are the correct widths, but you should check them and adjust if needed:

    First Table: width = 428 px

    Second Table: width = 475 px

    Third Table: width = 474 px

    These changes can be made in JasperSoft Studio without the need of direct editing of the source.

    Example

    The following is the jrxml for your summary band with the adjusted table widths to match the width of the columns inside the table. Any adjustment to the column sizes will required you to change the widths of the tables.

    <summary>
        <band height="343">
            <staticText>
                <reportElement positionType="Float" x="39" y="1" width="241" height="20" uuid="7ba83b4b-6038-4657-ae77-a50396d66cea"/>
                <textElement>
                    <font fontName="Times New Roman" size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[A.    Posisi TKA Baru yang disetujui :]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" x="39" y="83" width="58" height="20" isPrintWhenDetailOverflows="true" uuid="e6d5218f-5d8d-4521-bad1-0697e09cfa3d"/>
                <textElement>
                    <font fontName="Times New Roman" size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[B.    Daftar ]]></text>
            </staticText>
            <staticText>
                <reportElement positionType="Float" x="39" y="160" width="58" height="20" isPrintWhenDetailOverflows="true" uuid="f797ef70-f498-40e0-9f35-181c0bf16933"/>
                <textElement>
                    <font fontName="Times New Roman" size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[C.    Daftar]]></text>
            </staticText>
            <componentElement>
                <reportElement key="table 17" style="table 17" positionType="Float" x="39" y="21" width="428" height="57" isPrintWhenDetailOverflows="true" uuid="6fb859a1-5044-47bd-9249-63fa455470aa">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </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="Table Dataset 1" uuid="84090836-d798-43a0-93bc-3cde0db803f2">
                        <datasetParameter name="REPORT_DATA_SOURCE">
                            <datasetParameterExpression><![CDATA[$P{DS1}]]></datasetParameterExpression>
                        </datasetParameter>
                    </datasetRun>
                    <jr:column width="28" uuid="3363640b-30fb-4c36-b1f6-bc0a53cda03d">
                        <jr:columnHeader style="table 17_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="28" height="30" uuid="bd296baa-e9fe-43de-900e-7c71cd341787"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[No.]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 17_TD" height="20" rowSpan="1">
                            <textField isStretchWithOverflow="true">
                                <reportElement isPrintRepeatedValues="false" x="0" y="0" width="28" height="20" isPrintWhenDetailOverflows="true" uuid="128b482b-45e2-4f5c-aeaf-87807921e469"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="136" uuid="20b03b70-6219-4d3b-8261-90b28ca98420">
                        <jr:columnHeader style="table 17_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="136" height="30" uuid="4981f674-08fc-473e-8c5b-fef5b708f14d"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[Posisi TKA]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 17_TD" height="20" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement isPrintRepeatedValues="false" x="0" y="0" width="136" height="20" isPrintWhenDetailOverflows="true" uuid="7e868880-19a9-4d1d-be80-b75f7b508427"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{posisiTka}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="67" uuid="0bd520ee-899a-4a09-a728-40b7e0ded152">
                        <jr:columnHeader style="table 17_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="67" height="30" uuid="5db7fe89-668a-47f1-a74d-89845dc000c9"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[Dept.]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 17_TD" height="20" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement isPrintRepeatedValues="false" x="0" y="0" width="67" height="20" isPrintWhenDetailOverflows="true" uuid="44c8d21d-f8d0-4728-8270-0655cf9c02bf"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{departemen}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="88" uuid="41258d68-dd01-4e48-b59e-cdf94f31bd4a">
                        <jr:columnHeader style="table 17_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="88" height="30" uuid="b5d619ef-d7df-4ce1-9684-ac667f2123e7"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[Periode Penggunaan]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 17_TD" height="20" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement x="0" y="0" width="88" height="20" isPrintWhenDetailOverflows="true" uuid="6ace5c77-cebd-480c-994d-31c593dfe1c9"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{periode}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="109" uuid="0923900a-06e1-46b5-9b06-d7cbd97cea32">
                        <jr:columnHeader style="table 17_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="109" height="30" uuid="7dda780f-29a0-44be-a5bf-de7c059c8b1e"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[Keterangan]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 17_TD" height="20" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement isPrintRepeatedValues="false" x="0" y="0" width="109" height="20" isPrintWhenDetailOverflows="true" uuid="683f9507-e3dd-4afe-88bf-29df3296186b"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{keterangan}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:table>
            </componentElement>
            <componentElement>
                <reportElement key="table 17" style="table 17" positionType="Float" x="39" y="103" width="475" height="52" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="5b51d0bf-d1e9-4745-8ade-b69474871a79">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </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="Table Dataset 1" uuid="1c0dad36-2ce8-481d-aa16-738c65ddbcbe">
                        <datasetParameter name="REPORT_DATA_SOURCE">
                            <datasetParameterExpression><![CDATA[$P{DS2}]]></datasetParameterExpression>
                        </datasetParameter>
                    </datasetRun>
                    <jr:column width="28" uuid="3dd2aa48-6001-475e-8084-b71fe13e63ef">
                        <jr:columnHeader style="table 17_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="28" height="30" uuid="cc51c75b-a38f-4142-996b-ccb0e33503d6"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[No.]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 17_TD" height="20" rowSpan="1">
                            <textField>
                                <reportElement x="0" y="0" width="28" height="20" uuid="46b22f66-15b3-4819-a353-bb147e83f7af"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="136" uuid="a5200240-1b8e-48ff-a898-60de9a6d8956">
                        <jr:columnHeader style="table 17_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="136" height="30" uuid="f6e47ed7-3098-4c7f-a773-02b48b0c66d3"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[Posisi TKA]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 17_TD" height="20" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement x="0" y="0" width="136" height="20" isPrintWhenDetailOverflows="true" uuid="64e41021-7e4d-4c7e-80e4-5ba3c2f7073c"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{posisiTka}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="67" uuid="2f7ca895-6e44-4f8d-8b74-01e074514361">
                        <jr:columnHeader style="table 17_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="67" height="30" uuid="60a909a9-e015-4bb5-8ecc-8e6b85b27570"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[Dept.]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 17_TD" height="20" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement x="0" y="0" width="67" height="20" isPrintWhenDetailOverflows="true" uuid="dc8674f0-f94e-43b7-9d41-2fdde8873095"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{departemen}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="88" uuid="eb28444a-0f7a-4d0d-ae62-c3189cc73503">
                        <jr:columnHeader style="table 17_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="88" height="30" uuid="5cbf811c-eef7-49d0-8137-013b3b5e1a72"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[Periode Penggunaan]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 17_TD" height="20" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement x="0" y="0" width="88" height="20" isPrintWhenDetailOverflows="true" uuid="db724659-5863-428a-ab7f-4dae8bd04d42"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{periode}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="157" uuid="ac699b7b-c128-4a90-bd72-caddb826c491">
                        <jr:columnHeader style="table 17_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="157" height="30" uuid="a0debb58-3628-4861-bf81-019f4dd7f638"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[Keterangan]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 17_TD" height="20" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement x="0" y="0" width="157" height="20" isPrintWhenDetailOverflows="true" uuid="8b2d4d5a-80a1-4701-bfd5-519fd1c5f733"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{keterangan}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:table>
            </componentElement>
            <componentElement>
                <reportElement key="table 18" style="table 18" positionType="Float" x="39" y="181" width="474" height="70" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="0f49d051-fe9a-45ee-a5ab-d570a0b3b2e5">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </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="Table Dataset 1" uuid="28d7100b-eb32-4d34-9222-0141bf26b9f3">
                        <datasetParameter name="REPORT_DATA_SOURCE">
                            <datasetParameterExpression><![CDATA[$P{DS3}]]></datasetParameterExpression>
                        </datasetParameter>
                    </datasetRun>
                    <jr:column width="32" uuid="0ab7278c-e13d-4233-9e82-350e39d1d96a">
                        <jr:columnHeader style="table 18_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="32" height="30" uuid="a41722a3-74fd-4e9d-ba1c-70e54eb0576d"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[No.]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 18_TD" height="30" rowSpan="1">
                            <textField>
                                <reportElement x="0" y="0" width="32" height="20" uuid="e91dfa23-53ba-4252-a23a-c03b72927b76"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="90" uuid="707eacdf-9a63-4142-bd34-6a325b7a9492">
                        <jr:columnHeader style="table 18_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="90" height="30" uuid="b8eaaa00-e9e6-47e3-a727-6273ed3e572f"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[Nama Posisi Sebelumnya]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 18_TD" height="30" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement x="0" y="0" width="90" height="20" isPrintWhenDetailOverflows="true" uuid="996833d4-3fe3-4194-acef-6f8586b758ab"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{posisiSebelumnya}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="107" uuid="dca6e995-3c22-4996-99dd-874fdfab4890">
                        <jr:columnHeader style="table 18_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="107" height="30" uuid="90a99334-9730-4a70-957e-45ae46cf264e"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[Perubahan Nama Posisi yang Disetujui]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 18_TD" height="30" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement x="0" y="0" width="107" height="20" isPrintWhenDetailOverflows="true" uuid="ecf7a33f-3b75-4da9-9636-809887e4bfe3"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{posisiTka}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="64" uuid="4cc762f7-ec87-4fc2-b253-ac3035baed61">
                        <jr:columnHeader style="table 18_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="64" height="30" uuid="425a68df-2c74-4e22-8460-2e34707da3c5"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[Dept.]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 18_TD" height="30" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement x="0" y="0" width="64" height="20" isPrintWhenDetailOverflows="true" uuid="386e3887-8962-4273-9d43-4843e9c87c03"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{departemen}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="90" uuid="448fb74b-aeff-4e4f-b92c-47718869e67f">
                        <jr:columnHeader style="table 18_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="90" height="30" uuid="8e8f5ec8-f2d2-4482-aad1-92a69e062f1f"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[Periode Penggunaan]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 18_TD" height="30" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement x="0" y="0" width="90" height="20" isPrintWhenDetailOverflows="true" uuid="c0739140-feae-4f5e-bc92-5301f819d207"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{periode}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="91" uuid="d574582b-535a-47c6-a2d6-73eab6970a84">
                        <jr:columnHeader style="table 18_CH" height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="91" height="30" uuid="88f0969f-f791-40fd-88f4-5db2df6d2403"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <text><![CDATA[Keterangan]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="table 18_TD" height="30" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement x="0" y="0" width="91" height="20" isPrintWhenDetailOverflows="true" uuid="7cd271d1-0b72-41a8-8521-4b2b533924ff"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{keterangan}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:table>
            </componentElement>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement positionType="Float" x="100" y="160" width="455" height="20" isPrintWhenDetailOverflows="true" uuid="faf5ca75-b403-4120-bba0-d463876a7ce5"/>
                <textElement>
                    <font fontName="Times New Roman" size="12" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{terbilangTable3}]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true">
                <reportElement positionType="Float" x="99" y="83" width="456" height="20" isPrintWhenDetailOverflows="true" uuid="64e2c935-dbf3-4d4f-a8c9-7d7b264c3c1c"/>
                <textElement>
                    <font fontName="Times New Roman" size="12" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{terbilangTable2}]]></textFieldExpression>
            </textField>
        </band>
    </summary>