• Post Reply Bookmark Topic Watch Topic
  • New Topic

Saving a openoffice worksheet but it save as a .zip extension instead of .ods extemsion  RSS feed

 
chaolan lee
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings,
currently i'm facing a problem. I create a program when user click on a link, it will prompt the user to open or save the openoffice worksheet (.ods)

However when user clicks on the save option, it prompt to save as a .zip file extension instead of the .ods extension

Therefore i think of this solution to solve my problem which i do not know if i'm on the right track

So therefore i do this following.

1) I set the href to activate the javascript.

2) At the javascript, i will submit the form using the javascript submit option.

In html:



In javascript


Therefore in the servlet, i need to write to set the content type of the file. So i will like to ask whats the content type for the openoffice file and how do i write to enable to download as .ods extension? Below is part of my code in servlet to set the open office content type



Lastly how to i write the codes to save as .ods extension? I have try to search online but i could not find any examples. Please do guide me if anyone of you have any ideas or some solutions from the internet to solve my problem

Thanks
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The proper content types are listed in http://en.wikipedia.org/wiki/OpenDocument. Look for "internet media type".

You'll also need to set the Content-Disposition header where you specif the filename. It looks something like

response.setHeader("Content-Disposition", "attachment; filename=\"foobar.ods\"")
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!