如何利用C#从WORD中读取内容并存入数据库
按个按钮1后,从WORD中读取内容显示在textbox中,按按钮2后,将读取的内容存入SQL数据库...
按个按钮1后,从WORD中读取内容显示在textbox中,按按钮2后,将读取的内容存入SQL数据库
展开
1个回答
展开全部
前提: 导入COM库:Microsoft word 11.0 Object Library. 引用里面就增加了: 打开文档: object oMissing = System.Reflection.Missing.Value; Word._Application oWord; Word._Document oDoc; oWord = new Word.Application(); oWord.Visible = true; object fileName = @"E:CCCXCXXTestDoc.doc"; oDoc = oWord.Documents.Open(ref fileName, 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, ref oMissing, ref oMissing); 导入模板 object oMissing = System.Reflection.Missing.Value; Word._Application oWord; Word._Document oDoc; oWord = new Word.Application(); oWord.Visible = true; object fileName = @"E:XXXCCXTest.doc"; oDoc = oWord.Documents.Add(ref fileName, ref oMissing, ref oMissing, ref oMissing);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询