0

我已经在我的应用程序中实现了 Jasper Reports。但我必须让它通用吗?请给我一些建议?例如,

<property name="net.sf.jasperreports.export.csv.exclude.origin.keep.first.band.columnHeader" value="columnHeader" />
    <property name="net.sf.jasperreports.export.csv.exclude.origin.band.columnFooter" value="columnFooter" />
    <property name="net.sf.jasperreports.export.csv.exclude.origin.band.pageFooter" value="pageFooter" />
    <property name="net.sf.jasperreports.export.csv.exclude.origin.band.lastPageFooter" value="lastPageFooter" />
    <property name="net.sf.jasperreports.export.csv.exclude.origin.band.summary" value="summary" />
    <property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true" />
    <property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="pageFooter" />
    <property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.columnHeader" value="columnHeader" />
    <property name="net.sf.jasperreports.export.xls.auto.filter" value="Start" />
    <property name="net.sf.jasperreports.export.xls.freeze.column.edge" value="Left" />
    <property name="net.sf.jasperreports.print.keep.full.text" value="true"/>
    <property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
    <property name="net.sf.jasperreports.export.xls.property.ignore.page.margins" value="true"/>
    <property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>
    <property name="net.sf.jasperreports.export.xls.font.size.fix.enabled" value="true"/>
    <property name="net.sf.jasperreports.export.xls.collapse.row.span" value="true"/>
    <property name="net.sf.jasperreports.export.xls.white.page.background" value="false"/>

这种代码和平对于所有 jrxml 文件都是通用的。我想让它通用如何?

4

1 回答 1

0

我相信您可以将这些通用属性从 jrxml 文件中移出并放入一个名为的属性文件jasperreports.properties中(它必须在类路径中)。

它使用标准的 Java 属性文件格式而不是 XML 格式,例如

net.sf.jasperreports.export.csv.exclude.origin.keep.first.band.columnHeader=columnHeader
net.sf.jasperreports.export.csv.exclude.origin.band.columnFooter=columnFooter
# and so on...
于 2012-11-08T06:24:00.250 回答