Jump to content

CSV Extra Spacing Issue


pankajt

Recommended Posts

Hi Guys,

How we may remove the extra colums in CSV file. PDF file is generating well but in CSV we are getting blank colums.

Please suggest how we may remove extra columns. Following piece of code I am using.

Attached file I am getting while exporting.

response.setHeader("Content-Disposition", "attachment; filename="SMART STATION Report.csv"");

new JRCsvExporter();JASPER_PRINT, jasperPrint);OUTPUT_STREAM, outputStream);try {catch (JRException e) {throw new ServletException(e);finally {if (outputStream != null) {try {catch (IOException ex) {}

 JRCsvExporter exporterCsv = exporterCsv.setParameter(JRExporterParameter.

OutputStream outputStream = response.getOutputStream();

exporterCsv.setParameter(JRExporterParameter.

 exporterCsv.exportReport();}}

  outputStream.close();}}}

/* Code for CSV importing */

response.setContentType("application/csv");

 



Post Edited by pankajt at 05/07/2010 13:08
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi Guys,

This issue has been resolved. resolution is defined below:

1. Keep all rows with single column in header and manage all data inside that row in JRXML other wise extra spaces will display in CSV.  Good option is that, if data is not managiable at JRXMl side then pass a string from your class file as a parametrized argument.

2. Every row should start from initial position of JRXML otherwise extra spaces will display in CSV.

3. In Header, all field should be of same font otherwise in CSV header will shifted and may be some minor alignment problem.

4. Same in footer, keep all rows with single column and should start from initial position.

Regards

Pankaj

Link to comment
Share on other sites

  • 1 year later...

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...