I’m a learner in using Microsoft.Office.Interop.Word. Consider I have a word document with headings in style ‘Header1’ and some sentences of style ‘normal’ comes under it. Now I need to find those lines that comes under a paragraph of style ‘Header 1’. This is what I have been coded so for:
foreach (Microsoft.Office.Interop.Word.Paragraph paragraph in doc.Paragraphs)
{
Microsoft.Office.Interop.Word.Style style = paragraph.get_Style() as Microsoft.Office.Interop.Word.Style;
string styleName = style.NameLocal;
string text = paragraph.Range.Text;
if (styleName == "Heading 1")
{
MessageBox.Show("Sent lines :" + text.ToString()); //this will show all headings
}
}
How do I display the all lines that comes under those headings?
I think you want something like this, assuming I understand your question: