内容和表格内容一起读;
word内容:
代码:
1 public static void ReadWordByOpenXml(string path) 2 { 3 using (WordprocessingDocument doc = WordprocessingDocument.Open(path, true)) 4 { 5 Body body = doc.MainDocumentPart.Document.Body; 6 foreach (var inst in body.Elements<OpenXmlElement>()) 7 { 8 Console.WriteLine(inst.InnerText); 9 } 10 } 11 }