i was wondering what really happen behind the scene when i write a file with mime type like this application/vnd.ms-excel
i mean i export to excel like this:
gridView.Page.Response.Clear();
gridView.Page.Response.Buffer = true;
gridView.Page.Response.AddHeader("content-disposition",
"attachment;filename=GridViewExport.xls");
gridView.Page.Response.Charset = "";
gridView.Page.Response.ContentType = "application/vnd.ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
gridView.AllowPaging = false;
gridView.AllowSorting = false;
gridView.DataBind();
gridView.RenderControl(hw);
//style to format numbers to string
string style = @"<style> .textmode { mso-number-format:\@; } </style>";
gridView.Page.Response.Write(style);
gridView.Page.Response.Output.Write(sw.ToString());
gridView.Page.Response.Flush();
gridView.Page.Response.End();
i know excel files have specific format.so i was wondering how it gets done behind the scene ? what i think of is it just generate HTML and paste it into EXCEL and its not really exporting to EXCEL format ?
can any one correct me if im wrong ? or tell me what really happens behind the scene ?