I have generated excel report and i want the file to be downloaded by the user ,so how to set the response properties (content type) .
You need to set the headers and content type like this:
response.setHeader "Content-disposition", "attachment;filename=myExcel.xls"
response.contentType = "application/vnd.ms-excel"
Then stream the content in the response.
Edit: If you need to set the content length:
response.contentLength = 100
Content length documented in the javadoc
response.setContentType("APPLICATION/OCTET-STREAM");
response.setHeader("Content-Disposition", "Attachment;Filename=\"MyFile.xls\"");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With