469,283 Members | 2,297 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,283 developers. It's quick & easy.

Open Word/Excel file

Hi,

How do I open a Word or Excel document inside an event handler (e.g.,
Page_Load())?

Thanks,
Simon
Nov 19 '05 #1
4 2218
"Simon Cheng" <si************@hotmail.com> wrote in message
news:uF**************@TK2MSFTNGP15.phx.gbl...
How do I open a Word or Excel document inside an event handler (e.g.,
Page_Load())?


Depends where you want to open it. Do you want to open it server-side so you
can do some processing on it, or do want to open it client-side so that the
user can view / edit it?
Nov 19 '05 #2
It is intended to be shown to the end user as a read-only document.

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:OL*************@TK2MSFTNGP09.phx.gbl...
"Simon Cheng" <si************@hotmail.com> wrote in message
news:uF**************@TK2MSFTNGP15.phx.gbl...
How do I open a Word or Excel document inside an event handler (e.g.,
Page_Load())?
Depends where you want to open it. Do you want to open it server-side so

you can do some processing on it, or do want to open it client-side so that the user can view / edit it?

Nov 19 '05 #3
Response.Redirect("SomeFile.doc");

If that's too simplistic for you then look into Response.WriteFile.

Here's more info:
http://SteveOrr.net/Articles/EasyUploads.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Simon Cheng" <si************@hotmail.com> wrote in message
news:uF**************@TK2MSFTNGP15.phx.gbl...
Hi,

How do I open a Word or Excel document inside an event handler (e.g.,
Page_Load())?

Thanks,
Simon

Nov 19 '05 #4
In that case just return the document in the HTTP stream. You can open a
file stream to the Word document and the stream it into
Response.OutputStream. You should set hte content type to:
"application/msword".

Actually if the file lives on disk the following is the most efficient way
to get data back to the client:

Response.ContentType = "application/msword";
Response.TransmitFile(@"d:\articles\blog.doc");
Response.End();
Otherwise you have have to stream into Response.OutputStream().

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
http://www.west-wind.com/wwThreads/
----------------------------------
Making waves on the Web
"Simon Cheng" <si************@hotmail.com> wrote in message
news:es*************@TK2MSFTNGP12.phx.gbl...
It is intended to be shown to the end user as a read-only document.

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:OL*************@TK2MSFTNGP09.phx.gbl...
"Simon Cheng" <si************@hotmail.com> wrote in message
news:uF**************@TK2MSFTNGP15.phx.gbl...
How do I open a Word or Excel document inside an event handler (e.g.,
Page_Load())?


Depends where you want to open it. Do you want to open it server-side so

you
can do some processing on it, or do want to open it client-side so that

the
user can view / edit it?


Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by jerry.ranch | last post: by
1 post views Thread by Seok Bee | last post: by
7 posts views Thread by Peter | last post: by
7 posts views Thread by Peter | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.