473,320 Members | 1,828 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,320 software developers and data experts.

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 2386
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jenni | last post by:
Hi, A quick question. I have been battling with this code all morning, please help. Here is the code Dim fPath1 As String Dim fPath2 As String fPath1 = "C:\Program Files\Microsoft...
0
by: Steve Chatham | last post by:
I am stuck on this. It ought to be a simple reason as to why this is problematic, in that it works on smaller groups of data (say under 40 records), but doesn't on larger groups of records (40+)....
1
by: Seok Bee | last post by:
Dear Experts, I'm trying to open a file from my web form. However, when I click on the button, no action is being performed. I have tried running it in debugging mode, the file is able to open....
8
by: Radu | last post by:
Hi, I have the following problem: I open a recordset based on excel/csv files, but then I need to filter (in code) in order to extract only data pertaining to a specific person. This code is...
0
by: Vader | last post by:
I am new to this forum. Thanks in advance for and help. The following is what I am looking for: 1. I need help with VB code to open a MS Word (.doc) file. 2. Read lines from the MS Word (.doc)...
1
hidash
by: hidash | last post by:
hi everyone, i need some help in opening excel and word file using poi filesystem. i have created a new word and excel file using poi. but i am struggling to open the existing file using poi. pls...
7
by: Peter | last post by:
ASP.NET 2.0 I am trying to open a Word document and Excel document from a dialog web page, what's the best way to do that? I have tried the following: Response.Clear();...
7
by: Peter | last post by:
I have the following code which is executed from a modal web page - it works fine on most, but on some computers the Word loads into memory but never displays. This occurs with IE6 and IE7, but...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.