Jump to content
Changes to the Jaspersoft community edition download ×

2005 IR Help

Recommended Posts

By: Luis Gustavo Buffa - lgbuffa

XLS File

2004-01-28 02:30

Hi,

I've been exporting files as xls format and when the "save as" dialog is opened, I wanna have my default file name...is it possible?

I'm using the code below:

 

JRXlsExporter exporter = new JRXlsExporter();

response.setContentType("application/msexcel");

response.setContentType("application/vnd.ms-excel");

exporter.setParameter(JRExporterParameter.JASPER_PRINT, jPrint);

exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);

 

exporter.exportReport();

 

byte[] bytes = null;

 

bytes = baos.toByteArray();

 

response.setContentLength(bytes.length);

 

ServletOutputStream ouputStream = response.getOutputStream();

ouputStream.write(bytes, 0, bytes.length);

ouputStream.flush();

ouputStream.close();

 

Thanks,

Gustavo

 

 

 

 

By: Gregory A. Swarthout - gswarthout

RE: XLS File

2004-01-28 07:42

response.setHeader("Content-disposition", "inline; filename=" + myFilename);

 

 

 

 

 

By: Chuck Deal - cdeal

RE: XLS File

2004-01-28 07:57

I've tried this method before, and I didn;t have any luck. Any thoughts as to why this might not work?

 

Reports are generated via a servlet in PDF format streamed to a new IE browser window.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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