Hi Emi,
We have a Java/J2EE application and document (Word or Excel) will be generated at runtime on Server. Once the document is generated, we want to display it in browser window on Client machine. We are able to achieve this for PDF file but for Word (.doc or
.docx) and Excel (.xls or .xlsx) files, same code is showing a popup with options Open, Save, Save As.
Our code contains a Servlet in which response is populated as below
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");//MIME Type
response.setHeader("Content-disposition", "inline; filename=abc.docx");
response.setContentLength(<file contents size>);
//put file contents in response output stream
Below are the MIME types which we tried to use for different types of files
.doc |
application/msword |
.docx |
application/vnd.openxmlformats-officedocument.wordprocessingml.document |
.xls |
application/vnd.ms-excel |
.xlsx |
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
.pdf |
application/pdf |
Kindly suggest on how to achieve the requirement.
-
Edited by
NitinNahar
4 hours 16 minutes ago