kent.vickery Posted October 22, 2018 Share Posted October 22, 2018 When I export to CSV, if my report has multiple detail rows, everything is good. But if there is just one detail row then the column heading row is missing from the CSV - only the data row is generated. Any thoughts on what is going on here? Link to comment Share on other sites More sharing options...
hozawa Posted October 22, 2018 Share Posted October 22, 2018 Which version of JasperReports library are you using? Just tried it and everything is fine. It also may be your program. Link to comment Share on other sites More sharing options...
kent.vickery Posted October 22, 2018 Author Share Posted October 22, 2018 I am using version 6.0.0 Link to comment Share on other sites More sharing options...
kent.vickery Posted October 22, 2018 Author Share Posted October 22, 2018 String[] csvColumnNames = new String[] { "First", "Second", "Third" }JRCsvMetadataExporter exporter = new JRCsvMetadataExporter();SimpleCsvMetadataReportConfiguration configuration = new SimpleCsvMetadataReportConfiguration();exporter.setExporterInput(new SimpleExporterInput(jasperPrint));exporter.setExporterOutput(new SimpleWriterExporterOutput(outputStream));configuration.setColumnNames(csvColumnNames);configuration.setWriteHeader(true);exporter.setConfiguration(configuration);exporter.exportReport(); Link to comment Share on other sites More sharing options...
kent.vickery Posted October 22, 2018 Author Share Posted October 22, 2018 <textField> <reportElement uuid="47f37d6a-667f-42f2-9aa7-f6fed5204191" style="Table_PROJECT_TEXT" x="0" y="0" width="116" height="30" forecolor="#000000"> <property name="net.sf.jasperreports.export.csv.column.name" value="First"/> </reportElement> <textElement/> <textFieldExpression><![CDATA[$F{PROJECT_NAME}]]></textFieldExpression></textField> Link to comment Share on other sites More sharing options...
hozawa Posted October 23, 2018 Share Posted October 23, 2018 It's your jrxml. Have you seen the following thread?https://community.jaspersoft.com/questions/968896/jasper-reports-export-csv-does-not-print-column-names-when-having-only-one-data-row Link to comment Share on other sites More sharing options...
kent.vickery Posted October 23, 2018 Author Share Posted October 23, 2018 Thanks Hozawa. Adding the lastPageFooter band as shown in the thread above did the trick. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now