허당 레몬도리
  • 엑셀

엑셀변환시 형변환 방지 (텍스트가 숫자로 변환될때)

style="mso-number-format:\@"

 

Response.ContentType = "application/vnd.ms-excel";   //excel인지 word인지 구분

                        Response.AddHeader("Content-Disposition", "attachment; fileName=Stationery.xls"); //  저장할 파일명 지정

                        Response.Charset = "UTP-8";

                        /* */

 

                        System.IO.StringWriter tw = new System.IO.StringWriter();

                        System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);

 

                        GridView gdView = new GridView(); //그리드 뷰 객체

                        gdView.DataSource = dsList;

                        gdView.DataBind();

                        gdView.RenderControl(hw);

 

                        Response.Write("<DIV><table ><tr><td colspan='11'><center><h3>" + excelString + "</h3></center></td></tr></table></div>");

                        Response.Write(tw.ToString());

                        Response.End();


profile

허당 레몬도리

@LemonDory

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!