Search code examples
jasper-reportsexport-to-excel

jasper report export excel without page header


I created a template using jaspser studio. On the server, I am able to export the report out to excel. However, what I want is have the excel file only contain the column header and data, without the page header, footer, and any other ornaments. I saw a lot of tutorials using java programming. I am wondering whether there is a way to get this without programming in either java or xml.

For clarification, modifying some properties in xml file is ok. I just meant not creating a new xml from scratch.


Solution

  • This is possible through Jaspersoft Studio. More detail is available here

    You will need to add a new property to the report itself (Right Click > Show Properties > Advanced. Then properties under Misc.).

    Then you will need to add the following properties (For XLS format):

    <property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="pageHeader"/>
    <property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="pageFooter"/>
    

    If you are exporting to a XLSx format you will need to change xls to xlsx in the property name, like so:

    <property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.1" value="pageHeader"/>
    <property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.2" value="pageFooter"/>
    

    If you need to exclude more bands, there should be suitable information in the link I provided.