DocumentBuilderInsertFootnote Method (FootnoteType, String)

Inserts a footnote or endnote into the document.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.5
public Footnote InsertFootnote(
	FootnoteType footnoteType,
	string footnoteText


Type: Aspose.WordsFootnoteType
Specifies whether to insert a footnote or an endnote.
Type: SystemString
Specifies the text of the footnote.

Return Value

Type: Footnote
Returns a footnote object that was just created.
Shows how to reference text with a footnote and an endnote.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert some text and mark it with a footnote with the IsAuto attribute set to "true" by default,
// so the marker seen in the body text will be auto-numbered at "1", and the footnote will appear at the bottom of the page
builder.Write("This text will be referenced by a footnote.");
builder.InsertFootnote(FootnoteType.Footnote, "Footnote comment regarding referenced text.");

// Insert more text and mark it with an endnote with a custom reference mark,
// which will be used in place of the number "2" and will set "IsAuto" to false
builder.Write("This text will be referenced by an endnote.");
builder.InsertFootnote(FootnoteType.Endnote, "Endnote comment regarding referenced text.", "CustomMark");

// Footnotes always appear at the bottom of the page of their referenced text, so this page break will not affect the footnote
// On the other hand, endnotes are always at the end of the document, so this page break will push the endnote down to the next page

doc.Save(ArtifactsDir + "DocumentBuilder.InsertFootnote.docx");
See Also