作者:乔山办公网日期:
返回目录:office365
我现在机器从装了,代码都不知道去哪里了,
这个问题我在公司遇到过:
word和excel数据读取的问题,并zd在页面上显示并控制样式,数据最后入库
你这个很简版单不用对比格式,就两步骤:
数据读取操作,根据资料自己写的方法
页面控制样式,当初我是用jQuery控制的 隔行变色,光权棒效果,表格行高
按照这思路就没问题了,希望对你有用!
网上方法e5a48de588b67a64337不少,可以尝试搜索一下。
第一种方法:
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "Application/msword";
string s=Server.MapPath("E:/wendang/wo582.doc");
Response.WriteFile("E:/wendang/wo582.doc");
Response.Write(s);
Response.Flush();
Response.Close();
第二种方法:
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "Application/msword";
string strFilePath="";
strFilePath =Server.MapPath("E:/wendang/wo582.doc");
FileStream fs = new FileStream(strFilePath,FileMode.OpenOrCreate,FileAccess.Read);
Response.WriteFile(strFilePath,0,fs.Length);
fs.Close();
第三种方法:
string path=Server.MapPath("E:/wendang/wo582.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=wo582.doc");
Response.Flush();
Response.BinaryWrite(filedata);
Response.End();
常见word,百excel,ppt,pdf在线预度览方案,问有图有答真相,总有一回款适合你答!
http:///rainbowzc/p/3599171.html