国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

ASP.NET技巧:Web導(dǎo)出Word需要添加頭文件

2024-07-10 13:09:54
字體:
供稿:網(wǎng)友

這個在asp的時候我是這么做的,但是在asp.net中,還是推薦用現(xiàn)成的對象好,比如

httpcontext.current.response.appendheader("content-disposition", "attachment;filename=" + filename);
httpcontext.current.response.charset = "utf-8";
httpcontext.current.response.contentencoding = system.text.encoding.default;
httpcontext.current.response.contenttype = filetype;

//httpcontext.current.response.contenttype = "application/ms-excel";//upload/200902/jpeg;text/html;image/gif;vnd.ms-excel/msword

system.io.stringwriter tw = new system.io.stringwriter();
system.web.ui.htmltextwriter hw = new system.web.ui.htmltextwriter(tw);
gv.rendercontrol(hw);

httpcontext.current.response.write(tw.tostring());
httpcontext.current.response.end();  回復(fù)   

# re: web導(dǎo)出word需要添加頭文件 2006-08-15 23:50 堯堯
@aspnetx
是的,我也是用現(xiàn)成的,這就是上面我說的,我經(jīng)常導(dǎo)出excel,那個函數(shù)我寫在了
table導(dǎo)出為xls,doc,txt,htm方法
但如果導(dǎo)出word,就會出現(xiàn)編碼的問題,當(dāng)添了上面那段,問題就解決了:)


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 洛隆县| 涪陵区| 潜山县| 霍邱县| 东兴市| 太康县| 大余县| 山西省| 四子王旗| 莱阳市| 绥化市| 阳春市| 雅安市| 山东省| 福安市| 丰原市| 平乐县| 潞城市| 六枝特区| 北宁市| 大余县| 清涧县| 新河县| 佳木斯市| 内黄县| 年辖:市辖区| 永泰县| 湖口县| 吉木萨尔县| 霍邱县| 河南省| 涟源市| 通渭县| 鹤庆县| 商城县| 东辽县| 德兴市| 瓮安县| 华阴市| 双城市| 伊金霍洛旗|