Link to home
Start Free TrialLog in
Avatar of Eric3141
Eric3141Flag for Afghanistan

asked on

How to display Word.doc saved in db via a dialogue box that says Open, Save, Cancel?

We are developing a web app that saves documents (Word, Excel, other) in the database itself.  I need to display the saved files via a dialogue box that says Open, Save, Cancel.   I've found several examples of how to view it via IE itself but I need to launch Word, Excel, etc. to view the files.

Have any idea how to do this?  Can you point me to a resource online to show how to do this?

Thx in advance.

PS:  This needs to be in C#.
Avatar of mrichmon
mrichmon

From what I understand you cannot control this.  The user has the ability to determine how their browser should react to certain types of files.  If the user decides they want to have the browser open the file (i.e. view) within the browser - I don't think you can change that option.

The best you can do is provide the correct file types and application types to suggest to the browser what to do with he file, but then user preferences come into play after that...

At least that is what I have seen...
just think it might be done than what if you are opening the file in ms-word and it is not installed on the user computer
So always try to open such files in the browser itself to maintain the robustness of the application
Avatar of Eric3141

ASKER

shubham:  in our case here at work the customers want the document to open in Word.  If they don't have it installed they'll call our helpdesk and ask for it to be installed.  I understand that for a website made for the general public that might be a problem.  But here at our worksite MicroSoft Office comes loaded.  I can check the file extension of the file to be uploaded and make sure it's only one of the types that we have software loaded to view (.xls, .doc, etc.).
ASKER CERTIFIED SOLUTION
Avatar of Eric3141
Eric3141
Flag of Afghanistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just so you know that code you posted "suggests" to the browser to save - BUT the user can override that "suggestion"
You emailed asking:
======================================================
On Aug 26, you posted this comment about the solution to the question I asked:

Just so you know that code you posted "suggests" to the browser to save - BUT the user can override that "suggestion"

URL for the question = https://www.experts-exchange.com/questions/26409189/How-to-display-Word-doc-saved-in-db-via-a-dialogue-box-that-says-Open-Save-Cancel.html?cid=748&anchorAnswerId=33535325#a33535325

I didn't understand what you meant - please explain.  When I run the code I posted I get a dialogue box that has options for "Save, Open, or Cancel".  Were you saying that if I view a Word document this way and hit "Save" that it defaults to a file extension of .doc but the user can change that if he wants to?
======================================================


What it means is that the user can set their browser to automatically open those files - and not even prompt for the save option.  The user can also set the browser to auto-save and not prompt for open.  These user settings override anything you do on the server.

Also yes, the user can change the document extension if they want when they save the document.