I have some sample text like this:
1 Header
bla bla bla...
bla bla bla...
1.1 SubHeader
bla bla bla...
bla bla bla...
I read each page of the .docx file and I want to store the paragraphs under headers and the header as dictionary:
{"1 Header", "bla bla bla"...},
{"1.1 Subheader", "bla bla bla"...},
where the key is a string (header name) and the value is Paragraphs or List<Paragraph>
I know that this can be done with Selection(), but I don't know how to use it.
for (int i = 1; i<=paragraphCollection.Count;i++)
{
if (isHeader(paragraphCollection[i].Range.Text) || isSubHeader(paragraphCollection[i].Range.Text))
{
//collect paragraphs until we find another header or subheader
}
}
