最新国产好看的视频,伊人天堂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)文章

最新評論

济南市| 共和县| 萝北县| 永兴县| 九龙坡区| 聂荣县| 莫力| 玛纳斯县| 锦州市| 寿阳县| 永善县| 桂东县| 宜都市| 道真| 凌海市| 和静县| 同江市| 文化| 息烽县| 嘉善县| 庆城县| 宁海县| 汽车| 安化县| 微博| 洪江市| 阳曲县| 鹿邑县| 阜宁县| 五指山市| 天长市| 普定县| 嘉义市| 岑溪市| 斗六市| 建昌县| 连州市| 西安市| 博客| 汪清县| 海盐县|