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

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

am 29.01.2008 02:52:21 von maflatoun

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();

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

am 29.01.2008 04:26:16 von Mark Fitzpatrick

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:be97ad47-8e1c-4d25-b1a2-2d1b84c9cedb@l1g2000hsa.googleg roups.com...
> 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();