jaspersoft导出word、excel的一点点总结

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_23888451/article/details/53411517

最近在做模板遇到各种各样的问题,慢慢积累,慢慢补充......

WORD

1.word文档可编辑,可变行高,添加<property name="net.sf.jasperreports.export.docx.flexible.row.height" value="true"/>

2.在static text中换行shift+enter,在word中显示向下的箭头,设置“两端对齐”后,在导出的word中段落的最后一行也是两端对齐,而不会靠左对齐。添加<property name="net.sf.jasperreports.export.docx.new.line.as.paragraph" value="true"/>

3.一个主页面包含两个subreport,第二个subreport内容覆盖第一个,需设置第二个subreport的position type=float

4.当某个text field或static text根据条件不显示,又不想占用空间选择属性remove line when blank,下面的元素向上移动需设置position type=float

5.需要设置两个水平的元素(一个staticText,另一个是textField,并且textField设置为StretchWithOverflow)同高,需要把这两个元素放在一个组里,用标签<elementGroup></elementGroup>包围,并且设置stretchType="RelativeToTallestObject"

EXCEL

1.excel 设置border为1边框太黑,可以设置为0.5.

2.excel表格内容默认一行不换行,又显示所有内容,添加<property name="net.sf.jasperreports.export.xls.wrap.text" value="false"/>和<property name="net.sf.jasperreports.print.keep.full.text" value="true"/>

3.excel显示背景表格线,添加<property name="net.sf.jasperreports.export.xls.white.page.background" value="false"/>

4.excel的一些小建议链接 http://community.jaspersoft.com/questions/914501/tips-exporting-excel

猜你喜欢

转载自blog.csdn.net/qq_23888451/article/details/53411517