<address id="ousso"></address>
<form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
  1. C語言

    C語言讀取word文檔的方法

    時間:2025-05-21 03:37:36 C語言 我要投稿
    • 相關推薦

    C語言讀取word文檔的方法

      第一種方法:

      復制代碼 代碼如下:

      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();

      第二種方法:

      復制代碼 代碼如下:

      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();

      第三種方法:

      復制代碼 代碼如下:

      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();

    【C語言讀取word文檔的方法】相關文章:

    C語言中讀取時間日期的基本方法09-11

    word文檔分欄的方法08-12

    合并多個word文檔的方法09-16

    快速打開Word文檔的方法09-21

    word文檔加密方法分享10-03

    PHP生成Word文檔的方法06-28

    word文檔刪除分節符的方法09-12

    c語言讀取順序文件并處理10-11

    Word文檔出現亂碼的解決方法08-24

    <address id="ousso"></address>
    <form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
    1. 日日做夜狠狠爱欧美黑人