Header title's numbering

How to get the paragraph’s header Bullet Number. Example: My word document is:

1. This is header
This is content inside header.
2. This is another header
2.1 This is sub header

Now I want the text including the number in header title.

I have done :

foreach(Paragraph para in doc.GetChildNodes(NodeType.Paragraph,true))
{
    string headerTitle = para.GetText();
}

But, headerTitle comes as This is header Instead of 1. This is header

Thanks, in advance for any solution

Hi Hrishikesh,

Thanks for your inquiry. You can get the complete text using following code:

Document doc = new Document(MyDir + @"in.docx");
doc.UpdateListLabels();
foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true))
Console.WriteLine(para.ToString(SaveFormat.Text));

Hope, this helps.

Best regards,

Thanks, Awais Hafeez really helped!