insert_footnote method
Contents
[
Hide
]insert_footnote(footnote_type, footnote_text)
Inserts a footnote or endnote into the document.
def insert_footnote(self, footnote_type: aspose.words.notes.FootnoteType, footnote_text: str):
...
Parameter | Type | Description |
---|---|---|
footnote_type | FootnoteType | Specifies whether to insert a footnote or an endnote. |
footnote_text | str | Specifies the text of the footnote. |
Returns
Returns a footnote object that was just created.
insert_footnote(footnote_type, footnote_text, reference_mark)
Inserts a footnote or endnote into the document.
def insert_footnote(self, footnote_type: aspose.words.notes.FootnoteType, footnote_text: str, reference_mark: str):
...
Parameter | Type | Description |
---|---|---|
footnote_type | FootnoteType | Specifies whether to insert a footnote or an endnote. |
footnote_text | str | Specifies the text of the footnote. |
reference_mark | str | Specifies the custom reference mark of the footnote. |
Returns
Returns a footnote object that was just created.
Examples
Shows how to reference text with a footnote and an endnote.
doc = aw.Document()
builder = aw.DocumentBuilder(doc=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.insert_footnote(footnote_type=aw.notes.FootnoteType.FOOTNOTE, footnote_text='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.insert_footnote(footnote_type=aw.notes.FootnoteType.ENDNOTE, footnote_text='Endnote comment regarding referenced text.', reference_mark='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.insert_break(aw.BreakType.PAGE_BREAK)
doc.save(file_name=ARTIFACTS_DIR + 'DocumentBuilder.InsertFootnote.docx')
See Also
- module aspose.words
- class DocumentBuilder