內容和表格內容一起讀; word內容: 代碼: 1 public static void ReadWordByOpenXml(string path) 2 { 3 using (WordprocessingDocument doc = WordprocessingDocument.Open(path ...
內容和表格內容一起讀;
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 }View Code
效果: