엑셀 저장시 숫자를 스트링형으로 저장하기
protected void SaveExcel()
{
Response.Clear();
//Excel파일 저장
Response.ContentType = "application/vnd.ms-excel; name='My_Excel'";
Response.AddHeader("content-disposition", "attachment;filename=ISBNFindLib.xls");
Response.AddHeader("content-description", "ASP Generated Data");
//Response.ContentType = "application/vnd.ms-excel; name='My_Excel'";
//Word파일 저장
/*
Response.AddHeader("content-disposition", "attachment;filename=ISBNFindLib.doc");
Response.ContentType = "application/vnd.word";
*/
StringWriter stringWriter = new StringWriter();
System.Web.UI.HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
DataGrid1.RenderControl(htmlWriter);
string strStyle = @"<style>td{mso-number-format:\@;} </style>";//숫자를 string형으로 전환해서 저장
Response.Write(strStyle);
Response.Write(stringWriter.ToString());
Response.End();
}