• Post Reply Bookmark Topic Watch Topic
  • New Topic

excel sheets

 
Atul Mishra
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a jsp file and a href link which points to a javascript function.
In the javascript functio I am trying to open an excel sheet stored in the server.

But it opens in IE, doesnt open in application excel, doesnt do a download either.

How can I do it ?
Right now I am just doing window.open("/....xls")

My mime type has xls settings.

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to investigate setting the content-disposition header to identify the file as an "attachment". Search this (and perhaps the Servlet or JSP) forum for details.
 
Atul Mishra
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear.

I should say I tried to create a servlet also and do this in the doPost method. Then I get junk charachers in the o/p. Excel dont open also.. Then I was trying javascript. Still no luck..

String fileName ="C:/Test.xls";
File targetFile = new File(fileName);

response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename="+fileName+"");

Thanks,
[ July 06, 2007: Message edited by: Atul Mishra ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll move this to the Servlets forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why a POST? Fetches should be done with a GET.

Regardless, how are you reading and streaming the bytes to the output stream?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!