Footnotes and Endnotes

Footnotes and endnotes are used for adding additional information, like notes about some terms, to the Word document's main text. They consist of two parts; the note's reference mark which has a number value and the note's body which has text content.

GemBox.Document represents both footnotes and endnotes with Note elements, but with a different NoteType.

The following example demonstrates how you can specify footnote and endnote settings as well as how to insert footnotes and endnotes into a document.

Screenshot of Word file with footnotes and endnotes
Word document with Footnote and Endnote elements
using GemBox.Document;

class Program
{
    static void Main()
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        var document = new DocumentModel();

        // Set footnotes and endnotes number style for all sections in the document.
        document.Settings.Footnote.NumberStyle = NumberStyle.LowerLetter;
        document.Settings.Endnote.NumberStyle = NumberStyle.LowerRoman;

        var section = new Section(document);
        document.Sections.Add(section);

        // Set footnotes number style for the current section.
        section.FootnoteSettings.NumberStyle = NumberStyle.Decimal;

        section.Blocks.Add(
            new Paragraph(document,
                new Run(document, "GemBox.Document"),
                new Note(document, NoteType.Footnote,
                    new Paragraph(document,
                        new Run(document, "Read more about GemBox.Document on "),
                        new Hyperlink(document, "https://www.gemboxsoftware.com/document", "overview page"),
                        new Run(document, "."))),
                new Run(document, " is a .NET component that enables developers to read, write, convert and print document files (DOCX, DOC, PDF, HTML, XPS, RTF and TXT)"),
                new Note(document, NoteType.Footnote, "Image formats like PNG, JPEG, GIF, BMP, TIFF and WMP are also supported."),
                new Run(document, " from .NET"),
                new Note(document, NoteType.Endnote, "GemBox.Document works on .NET Framework 3.5 or higher and platforms that implement .NET Standard 2.0 or higher."),
                new Run(document, " applications in a simple and efficient way.")));

        section = new Section(document);
        document.Sections.Add(section);

        // Set endnotes number style for the current section.
        section.EndnoteSettings.NumberStyle = NumberStyle.UpperRoman;

        section.Blocks.Add(
            new Paragraph(document,
                new Run(document, "The latest version of GemBox.Document can be downloaded from "),
                new Hyperlink(document, "https://www.gemboxsoftware.com/document/free-version", "here"),
                new Note(document, NoteType.Endnote,
                    new Paragraph(document,
                        new Run(document, "The latest fixes for all GemBox.Document versions can be downloaded from "),
                        new Hyperlink(document, "https://www.gemboxsoftware.com/document/downloads/BugFixes.htm", "here"),
                        new Run(document, "."))),
                new Run(document, ".")));

        document.Save("Footnotes and Endnotes.%OutputFileType%");
    }
}
Imports GemBox.Document

Module Program

    Sub Main()

        ' If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Dim document As New DocumentModel()

        ' Set footnotes and endnotes number style for all sections in the document.
        document.Settings.Footnote.NumberStyle = NumberStyle.LowerLetter
        document.Settings.Endnote.NumberStyle = NumberStyle.LowerRoman

        Dim section As New Section(document)
        document.Sections.Add(section)

        ' Set footnotes number style for the current section.
        section.FootnoteSettings.NumberStyle = NumberStyle.Decimal

        section.Blocks.Add(
            New Paragraph(document,
                New Run(document, "GemBox.Document"),
                New Note(document, NoteType.Footnote,
                    New Paragraph(document,
                        New Run(document, "Read more about GemBox.Document on "),
                        New Hyperlink(document, "https://www.gemboxsoftware.com/document", "overview page"),
                        New Run(document, "."))),
                New Run(document, " is a .NET component that enables developers to read, write, convert and print document files (DOCX, DOC, PDF, HTML, XPS, RTF and TXT)"),
                New Note(document, NoteType.Footnote, "Image formats like PNG, JPEG, GIF, BMP, TIFF and WMP are also supported."),
                New Run(document, " from .NET"),
                New Note(document, NoteType.Endnote, "GemBox.Document works on .NET Framework 3.5 or higher and platforms that implement .NET Standard 2.0 or higher."),
                New Run(document, " applications in a simple and efficient way.")))

        section = New Section(document)
        document.Sections.Add(section)

        ' Set endnotes number style for the current section.
        section.EndnoteSettings.NumberStyle = NumberStyle.UpperRoman

        section.Blocks.Add(
            New Paragraph(document,
                New Run(document, "The latest version of GemBox.Document can be downloaded from "),
                New Hyperlink(document, "https://www.gemboxsoftware.com/document/free-version", "here"),
                New Note(document, NoteType.Endnote,
                    New Paragraph(document,
                        New Run(document, "The latest fixes for all GemBox.Document versions can be downloaded from "),
                        New Hyperlink(document, "https://www.gemboxsoftware.com/document/downloads/BugFixes.htm", "here"),
                        New Run(document, "."))),
                New Run(document, ".")))

        document.Save("Footnotes and Endnotes.%OutputFileType%")

    End Sub
End Module

The only difference between footnotes and endnotes is where they appear in the document. A footnote is located on the bottom of the same page as the term it describes while an endnote is located either at the end of the document or at the end of the section, depending on its NoteSettings.

Footnote and endnote settings (such as location, numbering style, starting number, etc.) can be defined on the document level (with DocumentSettings.Footnote and DocumentSettings.Endnote properties) and on the section level (with Section.FootnoteSettings and Section.EndnoteSettings properties).

Check next example or download examples from GitHub.