How to insert Footnote and Endnote to the document



Can you please tell me how can I insert footnote and endnote to the document. I have go through your documentation and I couldn’t find any code snippet or sample for inserting footnote and endnote.

Thanks for your assistance.


Well, both Comment and Footnote classes are InlineStory inheritors. Hence, the code to add Footnote looks pretty much similar to code for adding comments:

DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write("Some text is added.");

Footnote footnote = new Footnote(doc, FootnoteType.Footnote);
footnote.Paragraphs.Add(new Paragraph(doc));
footnote.FirstParagraph.Runs.Add(new Run(doc, "Footnote text."));

Best Regards,