您的位置:程序门 -> .net技术 -> c#



在asp网页中怎样用c#读出word文档


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


在asp网页中怎样用c#读出word文档
发表于:2007-01-03 21:16:04 楼主
在asp网页中怎样用c#读出word文档?有没有专门的控件啊,若没有怎样写?
发表于:2007-01-03 21:17:451楼 得分:0
如果只是读取用流就可以实现了,打开当前页面显示word,如果存在交互,就要用owc控件了
发表于:2007-01-03 21:27:332楼 得分:0
用流读出来是乱码啊
发表于:2007-01-03 21:28:183楼 得分:0
word.applicationclass   word   =   new     word.applicationclass(); word.documents.open(ref   path,ref   o,ref   o,ref   o,ref   o,ref   o,ref   o,ref   o,ref   o,ref   openformat,ref   o,ref   o,ref   o,ref   o,ref   o,ref   o); object   sfilename   =   server.mappath( "aa.doc "); word.activedocument.saveas2000(ref   sfilename,ref   saveformat,ref   o,ref   o,ref   o,ref   o,ref   o,ref   o,ref   o,ref   o,ref   o); word.activedocument.close(ref   o,ref   o,ref   o); word.quit(ref   o,ref   o,ref   o);
发表于:2007-01-03 21:28:284楼 得分:0
引用   word的组件.
发表于:2007-01-03 21:35:075楼 得分:0
水平有限,看不懂能不能说详细点,谢谢
发表于:2007-01-03 21:39:516楼 得分:0
在工程中 添加-> 引用-> com组件,找到microsoft   word添加就可.
发表于:2007-01-03 22:03:297楼 得分:0
我的意思是把你的代码加下注释,有些我不理解,谢谢
发表于:2007-01-04 09:34:308楼 得分:0
up
发表于:2007-01-04 10:52:109楼 得分:0
给你找了个例子
http://blog.ahnw.gov.cn/user1/wagxu/archives/2006/426.html
发表于:2007-01-04 11:08:0010楼 得分:0
byte[]   input   =   new   byte[filelen];
        system.io.stream   uploadstream   =   fileupload1.postedfile.inputstream;
        uploadstream.read(input,   0,   filelen);
        uploadstream.position   =   0;
        system.io.streamreader   sr   =   new   system.io.streamreader(uploadstream,   system.text.encoding.default);
        msg.text   =   "您上传的文件内容是: <br/> <br/> "   +   sr.readtoend();
        sr.close();
        uploadstream.close();
        uploadstream   =   null;
        sr   =   null;
发表于:2007-01-04 20:29:3111楼 得分:0
object   nothing=system.reflection.missing.value   ;
//取得word文件保存路径
object   filename= "e:/站点//新建   microsoft   word   文档.doc ";
//创建一个名为wordapp的组件对象
word.application   wordapp=new   word.applicationclass();
//打开文档对象
wordapp.documents   .open   (ref   filename,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing);
this.read_tb   .text   =wordapp.mailmessage   .tostring   ();
//保存
wordapp.activedocument.saveas2000(ref   filename,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing,ref   nothing);
//关闭
wordapp.activedocument.close(ref   nothing,ref   nothing,ref   nothing);
wordapp.quit(ref   nothing,ref   nothing,ref   nothing);
----------------------------
还是读不出来
发表于:2007-01-04 21:22:1812楼 得分:0
我做过   挺麻烦的   下载一个   dll   微软的,同时那个网站就告诉你如何使用了   就是微软官方网站
发表于:2007-01-09 11:12:4213楼 得分:0
直接用response.redict( "wordfile.doc ")试试


快速检索

最新资讯
热门点击