G
Gunawan
Hi there,
I am using this code that I have found in the internet to generate excel
output.
Response.Clear();
Response.AddHeader("content-disposition",
"attachment;filename=kirim.xls");
Response.Charset = "";
// If you want the option to open the Excel file without saving than
// comment out the line below
// Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite =
new HtmlTextWriter(stringWrite);
//gv.RenderControl(htmlWrite);
this.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
But I've got this error (Exception) bellow when Response.End() issue.
"Unable to evaluate expression because the code is optimized or a native
frame is on top of the call stack."
How to correct this issue?
Regards,
Gun
I am using this code that I have found in the internet to generate excel
output.
Response.Clear();
Response.AddHeader("content-disposition",
"attachment;filename=kirim.xls");
Response.Charset = "";
// If you want the option to open the Excel file without saving than
// comment out the line below
// Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite =
new HtmlTextWriter(stringWrite);
//gv.RenderControl(htmlWrite);
this.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
But I've got this error (Exception) bellow when Response.End() issue.
"Unable to evaluate expression because the code is optimized or a native
frame is on top of the call stack."
How to correct this issue?
Regards,
Gun