LINQ&XML : Locating tables in a document.

I have written a program to extract text from .docx files, using LINQ to select each paragraph, and using the styling to determine where in the document it came from, for example, if a paragraph with a normal style comes after two paragraphs with heading 1 and three with heading three, I know it was in chapter 2, subchapter 3. All well and good so far.

Now, some documents contain tables and images that I want to extract too and know where they came from. So, I look for the tbl and drawing elements, and find them just fine, but I have trouble finding them in the context of how many paragraph with some styling have come before it.

Can I write a query to find only paragraphs that don't have normal formatting, and that are included in tables? Or is there some other trick that I don't know of?

by Gnzzz via /r/csharp

Leave a Reply