Click here to Skip to main content
15,904,023 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
I need to develop a web application which shows an image in the browser and on clicking that image it should open an open office spread sheet document.How can i do this i tried a lot but i could not find any source for implementing this.

Using the below code i am able to open a pdf file in the online i had implemented the same by placing an open office document but it is not working on clicking the link it is downloading the spread sheet document.but i need to open the open office document after clicking the button.


What I have tried:

i could not find any source can an on help me out
Posted
Updated 14-Dec-16 14:23pm

1 solution

All you do is have the server return the document with an appropriate MIME type. The browser will download the document and can launch it. The O/S will pick the app to open it in or ask the user which app to use. Essentially, it's no different than if you double-clicked a document on your desktop.

Code running in a browser can NOT access any resources of the client machine, and that includes launching executables.
 
Share this answer
 
Comments
kav@94 14-Dec-16 23:51pm    
can you please provide any links for implementing this
Dave Kreskowiak 14-Dec-16 23:53pm    
Google for "MVC file download tutorial". There's tons of them.
kav@94 15-Dec-16 0:13am    
It should be implemented with asp .net also i should open the open office spread sheet word document on clicking an image button in the browser not the download
Dave Kreskowiak 15-Dec-16 9:53am    
Unless the client machine has a component that can display a OpenOffice document in the web browser, you're not going to be able to do this.
F-ES Sitecore 16-Dec-16 4:32am    
Google for "asp.net webforms file download tutorial". There's tons of them.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900