Open XML: Word - Getting all Paragraphs marked as "Heading1" style

Viewed 9078

Using Word I have created a Docx with the standard normal.dot as a test. Hello-world level complexity.

I wish to get all the paragraphs which are styled with the "Heading1" style in Word.

I can get all the paragraphs, but don't know how to filter down to Heading1.

using (var doc = WordprocessingDocument.Open(documentFileName, false))
{
    paragraphs = doc.MainDocumentPart.Document.Body
                    .OfType<Paragraph>().ToList();
}
1 Answers
Related