การทำงานกับเชิงอรรถและหมายเหตุ
Aspose.Wordsนอกจากนี้ยังมีบางชั้นเรียน,วิธีการและคุณสมบัติสำหรับการทำงานกับเชิงอรรถและหมายเ.
แทรกหมายเหตุและตั้งค่าตัวเลือกหมายเลข
หากคุณต้องการแทรกเชิงอรรถหรือปลายหมายเหตุในเอกสารคำโปรดใช้วิธีการInsertFootnote วิธีนี้แทรกเชิงอรรถหรือปลายหมายเหตุลงในเอกสาร.
ชั้นเรียนEndnoteOptionsและFootnoteOptionsเป็นตัวแทนของตัวเลือกหมายเลขสำหรับเชิงอรรถและหมายเหตุ.
ตัวอย่างรหัสต่อไปนี้แสดงวิธีการแทรกหมายเหตุลงในเอกสารและตั้งค่าตัวเลือกการกำหน:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java | |
Document doc = new Document(dataDir + "TestFile.docx"); | |
DocumentBuilder builder = new DocumentBuilder(doc); | |
builder.write("Some text"); | |
builder.insertFootnote(FootnoteType.ENDNOTE, "Endnote text."); | |
EndnoteOptions option = doc.getEndnoteOptions(); | |
option.setRestartRule(FootnoteNumberingRule.RESTART_PAGE); | |
option.setPosition(EndnotePosition.END_OF_SECTION); | |
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-Java | |
Document doc = new Document(dataDir + "TestFile.docx"); | |
//Specify the number of columns with which the footnotes area is formatted. | |
doc.getFootnoteOptions().setColumns(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-Java | |
Document doc = new Document(dataDir + "TestFile.docx"); | |
//Set footnote and endnode position. | |
doc.getFootnoteOptions().setPosition(FootnotePosition.BENEATH_TEXT); | |
doc.getEndnoteOptions().setPosition(EndnotePosition.END_OF_SECTION); | |
dataDir = dataDir + "TestFile_Out.doc"; | |
// Save the document to disk. | |
doc.save(dataDir); |