Hi,
We need to extract all tables (from word document) and insert into a SQL server table. Can anyone help to get rows/columns from word document for each table?
See below what i'm trying...
using (WordprocessingDocument doc = WordprocessingDocument.Open(@"D:\DocFiles\LMA3.docx", true)) { IEnumerable<Paragraph> paragraphElement = doc.MainDocumentPart.Document.Descendants<Paragraph>(); foreach (OpenXmlElement section in doc.MainDocumentPart.Document.Body.Elements<OpenXmlElement>()) { if (section.GetType().Name == "Paragraph") { Paragraph par = (Paragraph)section; } else if (section.GetType().Name == "Table") { Table tab = (Table)section; } }