InsertFootnote

InsertFootnote(FootnoteType, string)

Inserts a footnote or endnote into the document.

public Footnote InsertFootnote(FootnoteType footnoteType, string footnoteText)
ParameterTypeDescription
footnoteTypeFootnoteTypeSpecifies whether to insert a footnote or an endnote.
footnoteTextStringSpecifies the text of the footnote.

Return Value

Returns a footnote object that was just created.

Examples

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 property 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 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 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 that this page break will push the endnote down to the next page.
builder.InsertBreak(BreakType.PageBreak);

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

See Also


InsertFootnote(FootnoteType, string, string)

Inserts a footnote or endnote into the document.

public Footnote InsertFootnote(FootnoteType footnoteType, string footnoteText, string referenceMark)
ParameterTypeDescription
footnoteTypeFootnoteTypeSpecifies whether to insert a footnote or an endnote.
footnoteTextStringSpecifies the text of the footnote.
referenceMarkStringSpecifies the custom reference mark of the footnote.

Return Value

Returns a footnote object that was just created.

Examples

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 property 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 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 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 that this page break will push the endnote down to the next page.
builder.InsertBreak(BreakType.PageBreak);

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

See Also