最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

asp.net(c#)下讀取word文檔的方法小結(jié)

 更新時間:2011年07月11日 21:00:43   作者:  
asp.net(c#)下讀取word文檔的方法小結(jié),需要的朋友可以參考下。
第一種方法:
復(fù)制代碼 代碼如下:

Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "Application/msword";
string s=Server.MapPath("C#語言參考.doc");
Response.WriteFile("C#語言參考.doc");
Response.Write(s);
Response.Flush();
Response.Close();

第二種方法:
復(fù)制代碼 代碼如下:

Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "Application/msword";
string strFilePath="";
strFilePath =Server.MapPath("C#語言參考.doc");
FileStream fs = new FileStream(strFilePath,FileMode.OpenOrCreate,FileAccess.Read);
Response.WriteFile(strFilePath,0,fs.Length);
fs.Close();

第三種方法:
復(fù)制代碼 代碼如下:

string path=Server.MapPath("C#語言參考.doc");
FileInfo file=new FileInfo(path);
FileStream myfileStream=new FileStream(path,FileMode.Open,FileAccess.Read);
byte[] filedata=new Byte[file.Length];
myfileStream.Read(filedata,0,(int)(file.Length));
myfileStream.Close();
Response.Clear();
Response.ContentType="application/msword";
Response.AddHeader("Content-Disposition","attachment;filename=文件名.doc");
Response.Flush();
Response.BinaryWrite(filedata);
Response.End();

相關(guān)文章

最新評論

任丘市| 平邑县| 阿拉尔市| 鄂州市| 射阳县| 天水市| 彭州市| 金沙县| 长阳| 西宁市| 栾川县| 根河市| 砚山县| 乐安县| 汶川县| 仁布县| 渑池县| 吉安市| 那坡县| 望奎县| 阳曲县| 池州市| 甘肃省| 黄浦区| 潮州市| 城市| 天台县| 化州市| 潮安县| 双牌县| 甘南县| 绥阳县| 德令哈市| 靖安县| 收藏| 隆昌县| 东平县| 金坛市| 互助| 新郑市| 台江县|