成人免费观看在线视频高清中文_亚洲黄在免一区二区不卡无码_亚洲大尺码专区在线观看_韩国精品福利一区二区看

好運物流網(wǎng)-全國領(lǐng)先的物流網(wǎng)   好運物流網(wǎng)-登錄  好運物流網(wǎng)-免費注冊 進入我的后臺 首頁 | 發(fā)布信息 | 服務項目 | 物流百科
物流查詢|物流公司|中國物流信息網(wǎng)-好運物流網(wǎng)
 
你正在查看的信息:資訊首頁->資訊頻道->IT編程技術(shù)->正文

C# HTML轉(zhuǎn)EXCEL的方法

更新時間:2022/4/23 17:01    出處:互聯(lián)網(wǎng)
已經(jīng)瀏覽
7306
private void ToExcel(string html)
        {

            Response.ContentType = "application/force-download";
            Response.AddHeader("content-disposition",
                "attachment; filename=" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls");
            Response.Write("<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">");
            Response.Write("<head>");
            Response.Write("<META http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">");
            string fileCss = Server.MapPath("~/UI/themes/DRP.UI.Ext.css");
            string cssText = string.Empty;
            StreamReader sr = new StreamReader(fileCss);
            var line = string.Empty;
            while ((line = sr.ReadLine()) != null)
            {
                cssText += line;
            }
            sr.Close();
            Response.Write("<style>" + cssText + "</style>");
            Response.Write("<!--[if gte mso 9]><xml>");
            Response.Write("<x:ExcelWorkbook>");
            Response.Write("<x:ExcelWorksheets>");
            Response.Write("<x:ExcelWorksheet>");
            Response.Write("<x:Name>Report Data</x:Name>");
            Response.Write("<x:WorksheetOptions>");
            Response.Write("<x:Print>");
            Response.Write("<x:ValidPrinterInfo/>");
            Response.Write("</x:Print>");
            Response.Write("</x:WorksheetOptions>");
            Response.Write("</x:ExcelWorksheet>");
            Response.Write("</x:ExcelWorksheets>");
            Response.Write("</x:ExcelWorkbook>");
            Response.Write("</xml>");
            Response.Write("<![endif]--> ");
            Response.Write(html);//HTML
            Response.Flush();
            Response.End();
        }
還可以看看其他文章,謝謝您的閱讀。
網(wǎng)站申明:系本文編輯轉(zhuǎn)載,來源于網(wǎng)絡,目的在于傳遞更多信息,并不代表本網(wǎng)贊同其觀點和對其真實性負責,所有權(quán)歸屬原作者。如內(nèi)容、圖片有任何版權(quán)問題,請聯(lián)系我們刪除。
上一篇:(轉(zhuǎn))C# TextBox ReadOnly / Enabled 時,在后臺代碼中卻無法獲得該值,如何解決? 下一篇:SQL Server中JOIN的使用方法總結(jié):INNER JOIN、OUTER JOIN、LEFT JOIN的區(qū)別及如何正確使用
更多相關(guān)的物流文章
IT編程技術(shù)  互聯(lián)網(wǎng)  2023-10-07  瀏覽:9146次
IT編程技術(shù)  互聯(lián)網(wǎng)  2022-11-24  瀏覽:12216次
IT編程技術(shù)  互聯(lián)網(wǎng)  2022-11-17  瀏覽:12897次
IT編程技術(shù)  互聯(lián)網(wǎng)  2022-11-17  瀏覽:12199次
IT編程技術(shù)  互聯(lián)網(wǎng)  2022-11-14  瀏覽:12249次
IT編程技術(shù)  互聯(lián)網(wǎng)  2022-11-06  瀏覽:12579次
IT編程技術(shù)  互聯(lián)網(wǎng)  2022-11-05  瀏覽:12100次
IT編程技術(shù)  互聯(lián)網(wǎng)  2022-11-05  瀏覽:11690次
IT編程技術(shù)  互聯(lián)網(wǎng)  2022-10-28  瀏覽:13517次
正在被瀏覽的文章
【IT編程技術(shù)】熱點文章
“掃一掃”微信公眾號
好運物流網(wǎng)公眾號二維碼
關(guān)于好運物流網(wǎng) - 聯(lián)系好運網(wǎng) - 物流公司查詢 - 物流知道 - 幫助中心 - 網(wǎng)站地圖
溫馨提示:防范支招 安全警示:貨運合作要有安全意識,需當面核實對方真實身份,要簽訂合同/協(xié)議、提供身份證等(防范支招)
免責聲明:本站只起到物流信息平臺作用,內(nèi)容的準確性以及物流過程中出現(xiàn)的任何風險均由發(fā)布者負責,與平臺無關(guān)。
好運物流網(wǎng)(haoyun56.com)  備案號:浙ICP備10210792號-4

浙公網(wǎng)安備 33080202000006號