Робота зі виносками та висновком
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); |
Встановіть положення виноски та 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); |