การทำงานกับเชิงอรรถและหมายเหตุ
Aspose.Wordsนอกจากนี้ยังมีบางชั้นเรียน,วิธีการและคุณสมบัติสำหรับการทำงานกับเชิงอรรถและหมายเ.
แทรกหมายเหตุและตั้งค่าตัวเลือกหมายเลข
หากคุณต้องการแทรกเชิงอรรถหรือปลายหมายเหตุในเอกสารคำโปรดใช้วิธีการ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); |