据我所知 - 最简短的方法是将文件转换为XML。然后,这将允许按标签查找表。
var fileinfo = new FileInfo(@"c:\Users\a1oleg\Desktop\myFile.docx");
XDocument xml = null;
using (StreamReader oReader = new StreamReader(fileinfo.FullName)
{
xml = XDocument.Load(oReader);
}
错误是:
System.Xml.XmlException:'根级别的数据无效。第1行,第1位。'
答案 0 :(得分:0)
您可以使用Microsoft.Office.Interop.Word
Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
Documents docs = app.Documents;
Document doc = docs.Open("C:\\users\\Test.docx", ReadOnly:true);
Table tbl = doc.Tables[1];
Range rg = tbl.Range;
Cells cells = rg.Cells;