本文主要是介绍jasperreports导出excel怎么取消grid line,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
最近遇到导出excel的需求,系统已经有了基于jasperreports制导出pdf的功能(模板是jaspersoft report制作的),图省事直接利用jasperreports的方法来导出excel。单导出的excel没有去掉grid line十分难看。后来查了一下,要去掉grid line很简单。
方式一:直接在jrxml的文件里配置
<property name="net.sf.jasperreports.export.xls.show.gridlines" value="false"/>
方式二:在代码里配置
JRXlsxExporter exporter = new JRXlsxExporter();
exporter.setExporterInput(SimpleExporterInput.getInstance(sheets1));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(new File("test.xlsx"));
SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration();
configuration.setShowGridLines(Boolean.FALSE);
configuration.setOnePagePerSheet(Boolean.FALSE);
configuration.setRemoveEmptySpaceBetweenColumns(true);
configuration.setWhitePageBackground(Boolean.FALSE);
exporter.setConfiguration(configuration);
exporter.exportReport();
最后上一张图看看什么是excel的grid line,就是下面红框标记的部分
导出的excel去掉grid line的样子
这篇关于jasperreports导出excel怎么取消grid line的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!