Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Open Word/Excel file

Reply
Thread Tools

Open Word/Excel file

 
 
Simon Cheng
Guest
Posts: n/a
 
      02-14-2005
Hi,

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

Thanks,
Simon


 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      02-14-2005
"Simon Cheng" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> 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?


 
Reply With Quote
 
 
 
 
Simon Cheng
Guest
Posts: n/a
 
      02-14-2005
It is intended to be shown to the end user as a read-only document.

"Mark Rae" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Simon Cheng" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
> > 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?
>
>



 
Reply With Quote
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      02-14-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> How do I open a Word or Excel document inside an event handler (e.g.,
> Page_Load())?
>
> Thanks,
> Simon
>
>



 
Reply With Quote
 
Rick Strahl [MVP]
Guest
Posts: n/a
 
      02-14-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> It is intended to be shown to the end user as a read-only document.
>
> "Mark Rae" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > "Simon Cheng" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >
> > > 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?
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Program to open a file in binary, skip X bytes and write the rest ofthe file to a new file scad C++ 4 05-28-2009 08:47 AM
Re: how to open a file in some application using Tkinter i am usingTKINTER to create GUI application i want to know how to open a worddocument in open office or any other applicatio Fredrik Lundh Python 1 01-09-2008 10:40 AM
File::open and File.open Schüle Daniel Ruby 4 10-24-2006 09:34 PM
Why cannot open .txt file with Encoding = UNICODE using javascript window.open()? ml Java 0 11-30-2004 07:43 AM
How do I open a database connection on an access file that currently open ? THY ASP .Net 4 08-22-2003 03:50 PM



Advertisments