Writing to users browser (system.io.stream outputstream)

Discussion in 'ASP .Net' started by mazdotnet, Jan 29, 2008.

  1. mazdotnet

    mazdotnet Guest

    Hi all,

    I'm trying to integrate a third party library that would parse an
    excel file and allows us to make changes to. Once I update the
    appropriate cells, I want to allow my users to download the modified
    file.

    It works by
    IWorkbook book =
    NativeExcel.Factory.OpenWorkbook(this.MapPath(FileName));
    ... I do all my modifications here
    book.SaveAs(where one of the options is System.IO.Stream outputstream)

    Now if I want to allow users to download this file, how would use the
    System.IO.Stream in the following context?

    Response.AddHeader("content-disposition", "attachment; filename=
    \"myfile.xls\"");

    // here

    Response.Flush();
    Response.End();
    mazdotnet, Jan 29, 2008
    #1
    1. Advertising

  2. You would use Response.Outputstream when using the SaveAs to output it to
    the browser through the response object.


    --
    Hope this helps,
    Mark Fitzpatrick
    Microsoft MVP - Expression


    "mazdotnet" <> wrote in message
    news:...
    > Hi all,
    >
    > I'm trying to integrate a third party library that would parse an
    > excel file and allows us to make changes to. Once I update the
    > appropriate cells, I want to allow my users to download the modified
    > file.
    >
    > It works by
    > IWorkbook book =
    > NativeExcel.Factory.OpenWorkbook(this.MapPath(FileName));
    > .. I do all my modifications here
    > book.SaveAs(where one of the options is System.IO.Stream outputstream)
    >
    > Now if I want to allow users to download this file, how would use the
    > System.IO.Stream in the following context?
    >
    > Response.AddHeader("content-disposition", "attachment; filename=
    > \"myfile.xls\"");
    >
    > // here
    >
    > Response.Flush();
    > Response.End();
    Mark Fitzpatrick, Jan 29, 2008
    #2
    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. brrrdog
    Replies:
    0
    Views:
    797
    brrrdog
    Jul 9, 2003
  2. HNguyen
    Replies:
    4
    Views:
    2,371
    HNguyen
    Dec 21, 2004
  3. Steve Jasper
    Replies:
    5
    Views:
    13,065
    soft-eng
    Oct 22, 2003
  4. Replies:
    2
    Views:
    3,557
  5. Chris  Ashley
    Replies:
    1
    Views:
    568
    Kevin Spencer
    Oct 2, 2007
Loading...

Share This Page