【发布时间】:2014-08-27 15:15:47
【问题描述】:
我想使用 c# 阅读 msword (.doc/.docx) 文件的全部内容,其中包含图像、样式、文本在 asp .net 中的所有内容。
我曾经写过以下代码,它运行良好。
// Microsoft.Office.Interop.Word.ApplicationClass wordApp = new
Microsoft.Office.Interop.Word.ApplicationClass();
string filePath1 = @"G:\ABOUT.docx";
object file = filePath1;
object nullobj = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Document doc = wordApp.Documents.Open(ref file,
ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj,
ref nullobj);
Microsoft.Office.Interop.Word.Document doc1 = wordApp.ActiveDocument;
string m_Content = doc1.Content.Text;
txtbook.Text = m_Content;
doc.Close(ref nullobj, ref nullobj, ref nullobj);
但它无法读取图像文件。
请帮助我想将数据库中的全部内容保存为 html 格式并以 html 格式检索。
【问题讨论】:
-
Open xml sdk 是很好的解决方案。