使用word.application对象从word文件中读取出文本信息,然后进行编码转换,再构造HTML网页并且存储。
操作word中其他控件对象相对麻烦一些,正在学习研究中。
//
打开文件读取内容
Microsoft.Office.Interop.Word.Application myWordApp
=
new
Microsoft.Office.Interop.Word.ApplicationClass();
int
num
=
myWordApp.Documents.Count;
object
path
=
@"
D:RogerWithLogWORD est.doc
"
;
Document myWordDoc;
object
oMissing
=
System.Reflection.Missing.Value;
object
read
=
true
;
myWordDoc
=
myWordApp.Documents.Open(
ref
path,
ref
oMissing,
ref
read,
ref
oMissing,
ref
oMissing,
ref
oMissing,
ref
oMissing,
ref
oMissing,
ref
oMissing,
ref
oMissing,
ref
oMissing,
ref
oMissing,
ref
oMissing,
ref
oMissing,
ref
oMissing,
ref
oMissing);
string
temp
=
myWordDoc.Content.Text;
this
.Literal1.Text
=
temp;
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
myWordDoc.Close(
ref
oMissing,