C#.Net でデータを Excel シートにエクスポートしています。「00123450098」のようなデータを持つ列があります。データは最初のゼロなしでエクスポートされます。データをそのまま表示したい。
これが私のエクスポートExcelコードです。
string style = @"<style> .text { mso-number-format:\@; } </style> ";
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader(
"content-disposition", string.Format("attachment; filename={0}", fileName));
HttpContext.Current.Response.ContentType = "application/ms-excel";
HtmlForm frm = new HtmlForm();
...................
...................
table.RenderControl(htw);
HttpContext.Current.Response.Write(style);
//render the htmlwriter into the response
HttpContext.Current.Response.Write(sw.ToString());
HttpContext.Current.Response.End();