How to prevent repetition of data display in report?

自作多情 提交于 2019-12-02 00:53:30

You have put your table component into the detail band. The detail band is repeated for every record in the dataset. You have two records, so your table is repeated twice; If you had more data, you would get many more repetitions.

You could get rid of the table component completely, putting each columnHeader element from the table into a <columnHeader> band, and each detailCell element into a <detail> band. Doing this should preserve the behaviour of the table component without repeating it. See http://community.jaspersoft.com/wiki/designing-report for an example of this.

Alternatively, you could simply move your table component into a different band that doesn't get repeated (e.g. <summary>).

Copy the table component in summary band and delete the detail band.

If you want repeated value in table data then edit your table component in Ireport and select the text field and uncheck the "Print Repeated Values" check box property of a text field.

XML CODE will be like this:-

          </jr:columnHeader>           <jr:detailCell style="table 1_TD" height="20" rowSpan="1">              <textField>                 <reportElement uuid="560916c9-e02a-40c9-a7af-a63d285b900a"            isPrintRepeatedValues="false" x="0" y="0" width="131" height="20"/>              <textElement textAlignment="Center" verticalAlignment="Middle">                  <font size="12"/>             </textElement>            <textFieldExpression><![CDATA[$F{schooldetails_Phone}]]>              </textFieldExpression>              </textField>             </jr:detailCell>           </jr:column> 

If your table shows multiple times within List component, uncheck "Print when Detail Overflow" and try. It works for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!