การทำงานกับเชิงอรรถและอ้างอิงท้ายเรื่อง

Aspose.Words ยังมีคลาส วิธีการ และคุณสมบัติบางอย่างสำหรับการทำงานกับเชิงอรรถและอ้างอิงท้ายเรื่อง

แทรกอ้างอิงท้ายเรื่องและตั้งค่าตัวเลือกการกำหนดหมายเลข

หากคุณต้องการแทรกเชิงอรรถหรืออ้างอิงท้ายเรื่องลงในเอกสาร Word โปรดใช้วิธี InsertFootnote วิธีการนี้จะแทรกเชิงอรรถหรืออ้างอิงท้ายเรื่องลงในเอกสาร

คลาส EndnoteOptions และ FootnoteOptions แสดงถึงตัวเลือกการกำหนดหมายเลขสำหรับเชิงอรรถและอ้างอิงท้ายเรื่อง

ตัวอย่างโค้ดต่อไปนี้แสดงวิธีการแทรกอ้างอิงท้ายเรื่องลงในเอกสารและตั้งค่าตัวเลือกการกำหนดหมายเลข:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET
Document doc = new Document(dataDir + "TestFile.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write("Some text");
builder.InsertFootnote(FootnoteType.Endnote, "Eootnote text.");
EndnoteOptions option = doc.EndnoteOptions;
option.RestartRule = FootnoteNumberingRule.RestartPage;
option.Position = EndnotePosition.EndOfSection;
dataDir = dataDir + "TestFile_Out.doc";
// Save the document to disk.
doc.Save(dataDir);

กำหนดจำนวนคอลัมน์เค้าโครงเชิงอรรถ

คุณสามารถกำหนดจำนวนคอลัมน์เค้าโครงเชิงอรรถได้โดยใช้คุณสมบัติ Columns หากคุณสมบัตินี้มีค่าเป็น 0 พื้นที่เชิงอรรถจะถูกจัดรูปแบบด้วยจำนวนคอลัมน์ตามจำนวนคอลัมน์บนเพจที่แสดง

ตัวอย่างโค้ดต่อไปนี้แสดงวิธีการตั้งค่าจำนวนคอลัมน์สำหรับโครงร่างเชิงอรรถ:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET
Document doc = new Document(dataDir + "TestFile.docx");
//Specify the number of columns with which the footnotes area is formatted.
doc.FootnoteOptions.Columns = 3;
dataDir = dataDir + "TestFile_Out.doc";
// Save the document to disk.
doc.Save(dataDir);

กำหนดตำแหน่งของเชิงอรรถและ EndNote

ตำแหน่งเชิงอรรถอาจอยู่ที่ด้านล่างของแต่ละหน้าหรือใต้ข้อความในแต่ละหน้า ตำแหน่งอ้างอิงท้ายเรื่องอาจอยู่ที่ส่วนท้ายของส่วนหรือส่วนท้ายของเอกสารก็ได้

ตัวอย่างโค้ดต่อไปนี้แสดงวิธีการตั้งค่าตำแหน่งของเชิงอรรถและอ้างอิงท้ายเรื่อง:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET
Document doc = new Document(dataDir + "TestFile.docx");
//Set footnote and endnode position.
doc.FootnoteOptions.Position = FootnotePosition.BeneathText;
doc.EndnoteOptions.Position = EndnotePosition.EndOfSection;
dataDir = dataDir + "TestFile_Out.doc";
// Save the document to disk.
doc.Save(dataDir);