Jump to content

Export to CSV missing column headings when just one detail record


kent.vickery

Recommended Posts

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

<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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...