色www,五月婷婷深爱五月,午夜国产一级片,色噜噜综合,国产大胸无码视频,清纯美女被操黄网站在线观看,波多野结衣av高清一区二区三区

C語(yǔ)言讀取word文檔的方法

時(shí)間:2025-10-31 11:00:53 C語(yǔ)言

C語(yǔ)言讀取word文檔的方法

  第一種方法:

  復(fù)制代碼 代碼如下:

  Response.ClearContent();

  Response.ClearHeaders();

  Response.ContentType = "Application/msword";

  string s=Server.MapPath("C#語(yǔ)言參考.doc");

  Response.WriteFile("C#語(yǔ)言參考.doc");

  Response.Write(s);

  Response.Flush();

  Response.Close();

  第二種方法:

  復(fù)制代碼 代碼如下:

  Response.ClearContent();

  Response.ClearHeaders();

  Response.ContentType = "Application/msword";

  string strFilePath="";

  strFilePath =Server.MapPath("C#語(yǔ)言參考.doc");

  FileStream fs = new FileStream(strFilePath,FileMode.OpenOrCreate,FileAccess.Read);

  Response.WriteFile(strFilePath,0,fs.Length);

  fs.Close();

  第三種方法:

  復(fù)制代碼 代碼如下:

  string path=Server.MapPath("C#語(yǔ)言參考.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();

【C語(yǔ)言讀取word文檔的方法】相關(guān)文章:

C語(yǔ)言中讀取時(shí)間日期的基本方法11-20

word文檔分欄的方法09-01

合并多個(gè)word文檔的方法08-03

PHP生成Word文檔的方法02-24

快速打開(kāi)Word文檔的方法08-24

word文檔加密方法分享02-15

c語(yǔ)言讀取順序文件并處理11-07

word文檔刪除分節(jié)符的方法08-18

Word文檔出現(xiàn)亂碼的解決方法02-26