Open Word/Excel file

Discussion in 'ASP .Net' started by Simon Cheng, Feb 14, 2005.

  1. Simon Cheng

    Simon Cheng Guest

    Hi,

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

    Thanks,
    Simon
    Simon Cheng, Feb 14, 2005
    #1
    1. Advertising

  2. Simon Cheng

    Mark Rae Guest

    "Simon Cheng" <> wrote in message
    news:...

    > 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?
    Mark Rae, Feb 14, 2005
    #2
    1. Advertising

  3. Simon Cheng

    Simon Cheng Guest

    It is intended to be shown to the end user as a read-only document.

    "Mark Rae" <> wrote in message
    news:...
    > "Simon Cheng" <> wrote in message
    > news:...
    >
    > > 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?
    >
    >
    Simon Cheng, Feb 14, 2005
    #3
  4. 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" <> wrote in message
    news:...
    > Hi,
    >
    > How do I open a Word or Excel document inside an event handler (e.g.,
    > Page_Load())?
    >
    > Thanks,
    > Simon
    >
    >
    Steve C. Orr [MVP, MCSD], Feb 14, 2005
    #4
  5. 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" <> wrote in message
    news:...
    > It is intended to be shown to the end user as a read-only document.
    >
    > "Mark Rae" <> wrote in message
    > news:...
    > > "Simon Cheng" <> wrote in message
    > > news:...
    > >
    > > > 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?
    > >
    > >

    >
    >
    Rick Strahl [MVP], Feb 14, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luis Esteban Valencia
    Replies:
    1
    Views:
    1,383
    Carl Prothman [MVP]
    Jan 12, 2005
  2. Franck
    Replies:
    1
    Views:
    4,844
  3. =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=

    Problem with Excel reports ::::Excel 2003 Migration To Excel 2007

    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=, Oct 5, 2007, in forum: ASP .Net
    Replies:
    15
    Views:
    1,500
    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=
    Oct 24, 2007
  4. viza
    Replies:
    0
    Views:
    663
  5. Replies:
    0
    Views:
    114
Loading...

Share This Page