473,395 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Open Word doc with option to Save/Open

Hi, I've created a web app which, at runtime, generates a list of
documents available for download, as asp:hyperlink tags. One of these
is a Word doc, and I need to give the user the option of saving the doc
or opening it, rather than simply having it open in a new Word window
when clicked. However, I cannot find what method etc to use. Any help
greatly appreciated!

Sep 12 '06 #1
2 1271
you need to the HTTP header Content-Disposition

an example:

Response.Buffer = true;
Response.Clear();
Response.AddHeader("content-length", document.Contents.Length.ToString());
Response.AddHeader("Content-Disposition", "attachment;
filename=Document.doc");
Response.ContentType = "application/msword";
Response.BinaryWrite(<byte array containing file>);
Response.Flush();
Response.End();
HTH

Ciaran O'Donnell

"mw****@mbasys.co.uk" wrote:
Hi, I've created a web app which, at runtime, generates a list of
documents available for download, as asp:hyperlink tags. One of these
is a Word doc, and I need to give the user the option of saving the doc
or opening it, rather than simply having it open in a new Word window
when clicked. However, I cannot find what method etc to use. Any help
greatly appreciated!

Sep 12 '06 #2

Thanks, got the basics working now so just a bit of re-formatting
needed!
I'd never even heard of that before...

Sep 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Martin Lucas-Smith | last post by:
I am trying to use PHP's COM support to open a URL from within MS Word then save the document. I am using PHP5.0.3/Apache2/WindowsXP. phpinfo() confirms that COM support is enabled. ...
1
by: Eager-Learner | last post by:
Thru window.open I can open a word document but I'm NOT ABLE TO restrict copy, paste and file save as option. So I tried window.showModalDialog, but thru this I can open only html or text. My...
10
by: Neil | last post by:
An article at http://news.com.com/2100-1012-991694.html?tag=fd_top states: "XML would allow easier interchange of data generated in Office documents with back-end systems or existing Web...
2
by: Todd | last post by:
Ok, this code works fine on the Web server machine. But when I try to run it via any other clients on the LAN, I keep getting scripting errors (the MS Word Document never opens.) Do I have to...
10
by: Åženol Akbulak | last post by:
Hi, I have a form page to print on my web application(asp.net). I want to show the page in WORD. I use that code in asp.net Page_Load event: Response.Clear(); Response.ContentType =...
4
by: Fabian | last post by:
Hello, I want to open a Word Document in my C# Programm. I tried this : Word.Application wordapp = new Word.Application(); object path = "TEST.DOC"; object vk_read_only = false; object...
4
by: Bishman | last post by:
Hi, Can someone suggest the best technique / method of opening a Word ( or any other ) Document from an SQL BLOB ? I have the process of saving and retrieveing the file from an SQL Binary...
0
by: ppardi | last post by:
I'm developing an addin for Word 2007 and I need to determine whether a user saves a Word 2007 document in an older format (97-2003) after a save as is done. The scenario is that the user starts...
0
by: Ang | last post by:
Hi, I want to open a word file on background instead of showing the process on client's screen. And then do mailmerge, after that allow user to saveas. (user simply click the button and IE will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.