脚注と文末脚注の操作

Aspose.Words は、脚注と文末脚注を操作するためのいくつかのクラス、メソッド、プロパティも提供します。

文末脚注の挿入と番号付けオプションの設定

Word文書に脚注や文末脚注を挿入したい場合は、insert_footnoteメソッドを使用してください。このメソッドは、文書に脚注または文末脚注を挿入します。

EndnoteOptions クラスと FootnoteOptions クラスは、脚注と文末脚注の番号付けオプションを表します。

次のコード例は、文書に文末脚注を挿入し、その番号付けオプションを設定する方法を示しています。

# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Python-via-.NET
doc = aw.Document(docs_base.my_dir + "Document.docx")
builder = aw.DocumentBuilder(doc)
builder.write("Some text")
builder.insert_footnote(aw.notes.FootnoteType.ENDNOTE, "Footnote text.")
option = doc.endnote_options
option.restart_rule = aw.notes.FootnoteNumberingRule.RESTART_PAGE
option.position = aw.notes.EndnotePosition.END_OF_SECTION
doc.save(docs_base.artifacts_dir + "WorkingWithFootnotes.set_endnote_options.docx")

脚注レイアウトの列数を設定する

columns プロパティを使用して、脚注レイアウトの列数を設定できます。このプロパティの値が 0 の場合、脚注領域は、表示されているページの列数に基づいて、いくつかの列でフォーマットされます。

次のコード例は、脚注レイアウトの列数を設定する方法を示しています。

# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Python-via-.NET
doc = aw.Document(docs_base.my_dir + "Document.docx")
# Specify the number of columns with which the footnotes area is formatted.
doc.footnote_options.columns = 3
doc.save(docs_base.artifacts_dir + "WorkingWithFootnotes.set_foot_note_columns.docx")

脚注と文末脚注の位置を設定する

脚注の位置は、各ページの下部または各ページのテキストの下に配置できます。文末脚注の位置は、セクションの終わりまたは文書の終わりにできます。

次のコード例は、脚注と文末脚注の位置を設定する方法を示しています。

# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Python-via-.NET
doc = aw.Document(docs_base.my_dir + "Document.docx")
doc.footnote_options.position = aw.notes.FootnotePosition.BENEATH_TEXT
doc.endnote_options.position = aw.notes.EndnotePosition.END_OF_SECTION
doc.save(docs_base.artifacts_dir + "WorkingWithFootnotes.set_footnote_and_end_note_position.docx")