第一种方法:复制代码代码如下:Response.ClearContent;Response.ClearHeaders;Response.ContentType=Applicat下面是小编为大家整理的2023年C语言读取word文档方法(精选文档),供大家参考。
第一种方法:
复制代码 代码如下:
Response.ClearContent;
Response.ClearHeaders;
Response.ContentType = "Application/msword";
string s=Server.MapPath"C#语言参考.doc";
Response.WriteFile"C#语言参考.doc";
Response.Writes;
Response.Flush;
Response.Close;
第二种方法:
复制代码 代码如下:
Response.ClearContent;
Response.ClearHeaders;
Response.ContentType = "Application/msword";
string strFilePath="";
strFilePath =Server.MapPath"C#语言参考.doc";
FileStream fs = new FileStreamstrFilePath,FileMode.OpenOrCreate,FileAccess.Read;
Response.WriteFilestrFilePath,0,fs.Length;
fs.Close;
第三种方法:
复制代码 代码如下:
string path=Server.MapPath"C#语言参考.doc";
FileInfo file=new FileInfopath;
FileStream myfileStream=new FileStreampath,FileMode.Open,FileAccess.Read;
byte[] filedata=new Byte[file.Length];
myfileStream.Readfiledata,0,intfile.Length;
myfileStream.Close;
Response.Clear;
Response.ContentType="application/msword";
Response.AddHeader"Content-Disposition","attachment;filename=文件名.doc";
Response.Flush;
Response.BinaryWritefiledata;
Response.End;
推荐访问:读取 语言 文档 C语言读取word文档方法 c语言读取word文档的方法 c语言读取word文档的方法有哪些 c语言读取word文档的方法是什么 c语言读取word文件内容
【2023年C语言读取word文档方法(精选文档)】相关文章: