GemBox.Document is a .NET component that enables you to read, write, edit, convert, and print document files from your .NET applications using one simple API.

Footnotes and Endnotes

Footnotes and endnotes are used to add a note about a term in a document. Footnotes are located on the same page as the terms they describe (below page content) while endnotes can be found at the end of the document or at the end of the section, depending on the endnote settings. Footnote and endnote settings (such as location, numbering style, starting number, etc.) can be defined on the document (used for newly added sections) and section level.

The following example shows how to specify footnote and endnote settings on both the document and section level as well as how to insert footnotes and endnotes that contain simple text or more complex content (such as hyperlinks).

Screenshot
Footnotes and Endnotes Screenshot

See the full code below, use Run Example to execute.

using System;
using System.IO;
using System.Linq;
using GemBox.Document;
using GemBox.Document.Drawing;

class Sample
{
    [STAThread]
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        DocumentModel document = new DocumentModel();

        // All sections added to the document will have footnotes
        // numbered using lower letters.
        document.Settings.Footnote.NumberStyle = NumberStyle.LowerLetter;

        // All sections added to the document will have endnotes
        // numbered using lower Roman.
        document.Settings.Endnote.NumberStyle = NumberStyle.LowerRoman;

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

        // All footnotes in this section will be numbered using digits.
        // All endnotes in this section will be numbered using lower Roman 
        // (taken from document settings).
        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, "More info at "),
                    new Hyperlink(document,
                        "https://www.gemboxsoftware.com/document/overview",
                        "our website"),
                    new Run(document, "."))),
            new Run(document, " is a .NET component that enables developers to read,"),
            new Run(document, " write, convert and print document files"),
            new Run(document, " (DOCX, DOC, PDF, HTML, XPS, RTF and TXT)"),
            new Note(document, NoteType.Endnote,
                "Image formats like PNG, JPEG, BMP and TIFF are also supported."),
            new Run(document, " from .NET"),
            new Note(document, NoteType.Footnote,
                "Minimum required .NET Framework version is 3.0."),
            new Run(document, " applications in a simple and efficient way.")));

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

        // All endnotes in this section will be numbered using upper Roman.
        // All footnotes in this section will be numbered using lower letters
        // (taken from document settings).
        section.EndnoteSettings.NumberStyle = NumberStyle.UpperRoman;

        section.Blocks.Add(new Paragraph(document,
            new Run(document, "All versions of GemBox.Document come in "),
            new Run(document, "the Microsoft Windows Installer"),
            new Note(document, NoteType.Footnote,
                ".MSI file format."),
            new Run(document, " format, which ensures you can easily install /"),
            new Run(document, " uninstall and use multiple GemBox.Document versions"),
            new Note(document, NoteType.Endnote,
                new Paragraph(document,
                    new Run(document, "You can get the latest version "),
                    new Hyperlink(document,
                        "https://www.gemboxsoftware.com/document/free-version",
                        "here"),
                    new Run(document, "."))),
            new Run(document, " on the same machine.")));

        document.Sections.Add(
            new Section(document,
                new Paragraph(document,
                    new Run(document, "GemBox.Document Free"),
                    new Note(document, NoteType.Endnote,
                        "Limited to 20 paragraphs."),
                    new Run(document, " is free of charge while GemBox.Document"),
                    new Run(document, " Professional is a commercial version"),
                    new Run(document, " licensed per developer."),
                    new Run(document, " Server deployment is royalty free."))));

        document.Save("Footnotes and Endnotes.docx");
    }
}
Imports System
Imports System.IO
Imports System.Linq
Imports GemBox.Document
Imports GemBox.Document.Drawing

Module Samples

    Sub Main()

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

        Dim document As DocumentModel = New DocumentModel

        ' All sections added to the document will have footnotes
        ' numbered using lower letters.
        document.Settings.Footnote.NumberStyle = NumberStyle.LowerLetter

        ' All sections added to the document will have endnotes
        ' numbered using lower Roman.
        document.Settings.Endnote.NumberStyle = NumberStyle.LowerRoman

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

        ' All footnotes in this section will be numbered using digits.
        ' All endnotes in this section will be numbered using lower Roman 
        ' (taken from document settings).
        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, "More info at "),
                    New Hyperlink(document,
                        "https://www.gemboxsoftware.com/document/overview",
                        "our website"),
                    New Run(document, "."))),
            New Run(document, " is a .NET component that enables developers to read,"),
            New Run(document, " write, convert and print document files"),
            New Run(document, " (DOCX, DOC, PDF, HTML, XPS, RTF and TXT)"),
            New Note(document, NoteType.Endnote,
                "Image formats like PNG, JPEG, BMP and TIFF are also supported."),
            New Run(document, " from .NET"),
            New Note(document, NoteType.Footnote,
                "Minimum required .NET Framework version is 3.0."),
            New Run(document, " applications in a simple and efficient way.")))

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

        ' All endnotes in this section will be numbered using upper Roman.
        ' All footnotes in this section will be numbered using lower letters
        ' (taken from document settings).
        section.EndnoteSettings.NumberStyle = NumberStyle.UpperRoman

        section.Blocks.Add(New Paragraph(document,
            New Run(document, "All versions of GemBox.Document come in "),
            New Run(document, "the Microsoft Windows Installer"),
            New Note(document, NoteType.Footnote,
                ".MSI file format."),
            New Run(document, " format, which ensures you can easily install /"),
            New Run(document, " uninstall and use multiple GemBox.Document versions"),
            New Note(document, NoteType.Endnote,
                New Paragraph(document,
                    New Run(document, "You can get the latest version "),
                    New Hyperlink(document,
                        "https://www.gemboxsoftware.com/document/free-version",
                        "here"),
                    New Run(document, "."))),
            New Run(document, " on the same machine.")))

        document.Sections.Add(
            New Section(document,
                New Paragraph(document,
                    New Run(document, "GemBox.Document Free"),
                    New Note(document, NoteType.Endnote,
                        "Limited to 20 paragraphs."),
                    New Run(document, " is free of charge while GemBox.Document"),
                    New Run(document, " Professional is a commercial version"),
                    New Run(document, " licensed per developer."),
                    New Run(document, " Server deployment is royalty free."))))

        document.Save("Footnotes and Endnotes.docx")

    End Sub

End Module

Check next sample.