首页 > 解决方案 > 如何在 CSV jasper-reports 6.5 中将逗号切换为分号

问题描述

我通过 jasper-reports 导出 CSV 文件。它工作正常,但我想将逗号切换为分号。我找到了一些解决方案,但已被弃用。我在 SimpleCsvReportConfiguration 中寻找一种没有快乐结局的方法。有人可以帮忙吗?

JRCsvExporter exporter = new JRCsvExporter();
exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrints));
exporter.setExporterOutput(new SimpleWriterExporterOutput(response.getOutputStream()));
SimpleCsvReportConfiguration configuration = new SimpleCsvReportConfiguration();
exporter.exportReport();

标签: javacsvjasper-reports

解决方案


您应该将其添加到您的 .jrxml 文件中:

<property name="net.sf.jasperreports.export.csv.field.delimiter" value=";"/>

推荐阅读