脚注と文末脚注の操作
Aspose.Wordsは、脚注と文末脚注を操作するためのクラス、メソッド、プロパティも提供します。
文末脚注の挿入と番号付けオプションの設定
Word文書に脚注または文末脚注を挿入する場合は、InsertFootnoteメソッドを使用してください。 このメソッドは、脚注または文末脚注を文書に挿入します。
EndnoteOptionsクラスとFootnoteOptionsクラスは、脚注と文末脚注の番号付けオプションを表します。
次のコード例は、文書にendnoteを挿入し、その番号付けオプションを設定する方法を示しています:
For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C | |
System::SharedPtr<Document> doc = System::MakeObject<Document>(inputDataDir + u"TestFile.docx"); | |
System::SharedPtr<DocumentBuilder> builder = System::MakeObject<DocumentBuilder>(doc); | |
builder->Write(u"Some text"); | |
builder->InsertFootnote(FootnoteType::Endnote, u"Eootnote text."); | |
System::SharedPtr<EndnoteOptions> option = doc->get_EndnoteOptions(); | |
option->set_RestartRule(FootnoteNumberingRule::RestartPage); | |
option->set_Position(EndnotePosition::EndOfSection); | |
System::String outputPath = outputDataDir + u"WorkingWithFootnote.SetEndnoteOptions.docx"; | |
// Save the document to disk. | |
doc->Save(outputPath); |
脚注レイアウト列の数を設定する
Columnsプロパティを使用して脚注レイアウト列の数を設定できます。 このプロパティの値が0の場合、脚注領域は、表示されるページの列数に基づいて列数で書式設定されます。
脚注レイアウトの列数を設定する方法を次のコード例に示します:
For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C | |
System::SharedPtr<Document> doc = System::MakeObject<Document>(inputDataDir + u"TestFile.docx"); | |
//Specify the number of columns with which the footnotes area is formatted. | |
doc->get_FootnoteOptions()->set_Columns(3); | |
System::String outputPath = outputDataDir + u"WorkingWithFootnote.SetFootNoteColumns.docx"; | |
// Save the document to disk. | |
doc->Save(outputPath); |
脚注とEndNoteの位置を設定します
脚注の位置は、各ページの下部または各ページのテキストの下に配置できます。 文末脚注の位置は、セクションの終わりまたは文書の終わりにすることができます。
次のコード例は、脚注と文末脚注の位置を設定する方法を示しています:
For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C | |
System::SharedPtr<Document> doc = System::MakeObject<Document>(inputDataDir + u"TestFile.docx"); | |
//Set footnote and endnode position. | |
doc->get_FootnoteOptions()->set_Position(FootnotePosition::BeneathText); | |
doc->get_EndnoteOptions()->set_Position(EndnotePosition::EndOfSection); | |
System::String outputPath = outputDataDir + u"WorkingWithFootnote.SetFootnoteAndEndNotePosition.docx"; | |
// Save the document to disk. | |
doc->Save(outputPath); |