Quantcast
Channel: Open XML Format SDK forum
Viewing all articles
Browse latest Browse all 1288

Get all tables values which exist in word document

$
0
0

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;
                    }
                }


Viewing all articles
Browse latest Browse all 1288

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>