跳到主要內容

發表文章

目前顯示的是 8月, 2008的文章

[ASP.Net] 分頁型Excel匯出

用產生xml的方式 gene 標頭用 xmlTextWriter 產生Excel 會在Excel 2003無法開啟 所以改用response.write產生 Response.Charset = "UTF8" Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8") Response.AddHeader("content-disposition", "attachment; filename=" & filename & ".xls") Response.ContentType = "application/vnd.ms-excel" Response.Write("<?xml version='1.0'?>") Response.Write("<?mso-application progid='Excel.Sheet() '?>") Response.Write("<Workbook xmlns='urn:schemas-microsoft-com:office:spreadsheet'") Response.Write(" xmlns:o='urn:schemas-microsoft-com:office:office'") Response.Write(" xmlns:x='urn:schemas-microsoft-com:office:excel'") Response.Write(" xmlns:ss='urn:schemas-microsoft-com:office:spreadsheet'") Response.Write(" xmlns:html='http://www.w3.org/TR/REC-html40'>") 每個Sheet開頭 Respon