Quantcast
Channel: NPOI
Viewing all articles
Browse latest Browse all 1621

New Post: Problem to response the xls File to the Client

$
0
0
Hi there, my problem is the file is not writing to the client side nothing happening

my code is above:
            //Save the Excel spreadsheet to a MemoryStream and return it to the client
            using (var exportData = new MemoryStream())
            {
                try
                {
                    hssfworkbook.Write(exportData);
                    string saveAsFileName = string.Format("ObrasNuevas-{0:d}.xls", DateTime.Now).Replace("/", "-");
                    Context.Response.ContentType = "application/vnd.ms-excel";
                    Context.Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", saveAsFileName));
                    Context.Response.Clear();
                    Context.Response.BinaryWrite(exportData.GetBuffer());
                    Context.ApplicationInstance.CompleteRequest();
                    //Context.Response.End();
                }
                catch (Exception ex)
                {
                    Context.Response.Write(ex.Message);
                }



            }
my server is Windows 2003 , only work with chrome but with ie i cant get the xls file


thanks
I really Appreciate your comments.

Viewing all articles
Browse latest Browse all 1621

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>