jasper中,excel , html, pdf 一般可以使用相同的主报表和子报表。需要在主报表中添加不同格式对应的属性。导出不同格式的报表,编译器会将相应的属性应用到对应的报表格式中。
常用属性如下,根据需要添加:
<property name="net.sf.jasperreports.page.break.no.pagination" value="apply"/>
excel:
<property name="net.sf.jasperreports.export.xls.one.page.per.sheet" value="true"/>
<property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
<property name="net.sf.jasperreports.export.xls.sheet.names.sheet1" value="Summary Variance by Dimension"/>
<property name="net.sf.jasperreports.export.xls.sheet.names.all" value="Country Summary/Geography Analysis/Entity Analysis"/>
<property name="net.sf.jasperreports.export.xls.wrap.text" value="false"/>
html:
<property name="net.sf.jasperreports.export.html.remove.empty.space.between.rows" value="true"/>
<property name="net.sf.jasperreports.export.html.using.images.to.align" value="false"/>
<property name="net.sf.jasperreports.export.html.frames.as.nested.tables" value="true"/>
<property name="net.sf.jasperreports.export.html.wrap.break.word" value="true"/>