Reputation: 1207
How can retrieve all footnotes of a word file in c# using open xml, i know that we can retrieve the paragraphs with some things like this:
IEnumerable<Paragraph> paragraphs = mainPart.Document.Body.OfType<Paragraph>();
but when i test it for footnotes i just get the null while i know there is some footnotes in my word file.
i have just find this pages to help me on this problem, but they didn't help me:
how can i get all the footnotes and save theme in a list.
Upvotes: 1
Views: 994
Reputation: 18096
Example to get the footnotes:
FootnotesPart footnotesPart = wordDoc.MainDocumentPart.FootnotesPart;
if (footnotesPart != null)
{
IEnumerable<Footnote> footnotes = footnotesPart.Footnotes.Elements<Footnote>();
...
}
Upvotes: 1