Работа со сносками и заключением
Aspose.Words также предоставляет некоторые классы, методы и свойства для работы со сносками и концевыми примечаниями.
Вставьте сноску в конце и задайте параметры нумерации
Если вы хотите вставить сноску или концевое примечание в документ Word, пожалуйста, используйте метод InsertFootnote. Этот метод позволяет вставить сноску или концевое примечание в документ.
Классы EndnoteOptions и FootnoteOptions представляют варианты нумерации для сноски и концевой сноски.
В следующем примере кода показано, как вставить концевую сноску в документ и задать параметры ее нумерации:
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); |
Установите положение сноски и концевой сноски
Сноска может располагаться внизу каждой страницы или под текстом на каждой странице. Сноска может располагаться в конце раздела или в конце документа.
В следующем примере кода показано, как задать положение сноски и концевой сноски:
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); |