องค์ประกอบที่แสดงถึงเชิงอรรถ Footnote
แต่ละรายการจะอยู่ภายใน ListItem
หรือ Paragraph
และมีองค์ประกอบ FootnoteSection
ที่สอดคล้องกันสําหรับเนื้อหาเชิงอรรถ' Footnote
เองต้องไม่มีองค์ประกอบอื่นๆ สําหรับข้อมูลเพิ่มเติมเกี่ยวกับโครงสร้างเอกสาร โปรดดูคู่มือการขยาย Google เอกสาร
เมธอด
วิธีการ | ประเภทการแสดงผล | รายละเอียดแบบย่อ |
---|---|---|
copy() | Footnote | แสดงผลสําเนาเดี่ยวที่แยกองค์ประกอบปัจจุบัน |
getAttributes() | Object | ดึงแอตทริบิวต์ของ' |
getFootnoteContents() | FootnoteSection | เรียกเนื้อหาขององค์ประกอบเชิงอรรถ |
getNextSibling() | Element | เรียกองค์ประกอบข้างเคียงขององค์ประกอบถัดไป |
getParent() | ContainerElement | เรียกองค์ประกอบหลักขององค์ประกอบ |
getPreviousSibling() | Element | เรียกองค์ประกอบระดับก่อนหน้าขององค์ประกอบ' |
getType() | ElementType | เรียกดูองค์ประกอบ'ElementType |
isAtDocumentEnd() | Boolean | กําหนดว่าองค์ประกอบอยู่ท้าย Document หรือไม่ |
removeFromParent() | Footnote | นําองค์ประกอบออกจากระดับบนสุด |
setAttributes(attributes) | Footnote | ตั้งค่าแอตทริบิวต์ขององค์ประกอบ |
เอกสารประกอบโดยละเอียด
copy()
แสดงผลสําเนาเดี่ยวที่แยกองค์ประกอบปัจจุบัน
ระบบจะคัดลอกองค์ประกอบย่อยที่แสดงในองค์ประกอบด้วย องค์ประกอบใหม่ไม่มีองค์ประกอบหลัก
ไปกลับ
Footnote
— สําเนาใหม่
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องได้รับสิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getAttributes()
ดึงแอตทริบิวต์ของ'
ผลลัพธ์คือออบเจ็กต์ที่มีพร็อพเพอร์ตี้สําหรับแอตทริบิวต์องค์ประกอบที่ถูกต้องแต่ละรายการ โดยที่ชื่อพร็อพเพอร์ตี้แต่ละรายการสอดคล้องกับรายการในการแจงนับ DocumentApp.Attribute
var body = DocumentApp.getActiveDocument().getBody(); // Append a styled paragraph. var par = body.appendParagraph('A bold, italicized paragraph.'); par.setBold(true); par.setItalic(true); // Retrieve the paragraph's attributes. var atts = par.getAttributes(); // Log the paragraph attributes. for (var att in atts) { Logger.log(att + ":" + atts[att]); }
ไปกลับ
Object
— แอตทริบิวต์'องค์ประกอบ
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องได้รับสิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getFootnoteContents()
เรียกเนื้อหาขององค์ประกอบเชิงอรรถ
ไปกลับ
FootnoteSection
— ส่วนเชิงอรรถ
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องได้รับสิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getNextSibling()
เรียกองค์ประกอบข้างเคียงขององค์ประกอบถัดไป
พี่น้องถัดไปมีระดับบนสุดเดียวกันและเป็นไปตามองค์ประกอบปัจจุบัน
ไปกลับ
Element
— องค์ประกอบพี่น้องถัดไป
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องได้รับสิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getParent()
เรียกองค์ประกอบหลักขององค์ประกอบ
องค์ประกอบระดับบนมีองค์ประกอบปัจจุบัน
ไปกลับ
ContainerElement
— องค์ประกอบระดับบน
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องได้รับสิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getPreviousSibling()
เรียกองค์ประกอบระดับก่อนหน้าขององค์ประกอบ'
พี่น้องก่อนหน้านี้มีออบเจ็กต์หลักเดียวกันและอยู่ก่อนองค์ประกอบปัจจุบัน
ไปกลับ
Element
— องค์ประกอบข้างเคียงก่อนหน้า
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องได้รับสิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getType()
เรียกดูองค์ประกอบ'ElementType
ใช้ getType()
เพื่อระบุประเภทที่แน่นอนขององค์ประกอบที่ระบุ
var body = DocumentApp.getActiveDocument().getBody(); // Obtain the first element in the document body. var firstChild = body.getChild(0); // Use getType() to determine the element's type. if (firstChild.getType() == DocumentApp.ElementType.PARAGRAPH) { Logger.log('The first element is a paragraph.'); } else { Logger.log('The first element is not a paragraph.'); }
ไปกลับ
ElementType
— ประเภทขององค์ประกอบ
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องได้รับสิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
isAtDocumentEnd()
removeFromParent()
นําองค์ประกอบออกจากระดับบนสุด
var body = DocumentApp.getActiveDocument().getBody(); // Remove all images in the document body. var imgs = body.getImages(); for (var i = 0; i < imgs.length; i++) { imgs[i].removeFromParent(); }
ไปกลับ
Footnote
— องค์ประกอบที่นําออก
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องได้รับสิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
setAttributes(attributes)
ตั้งค่าแอตทริบิวต์ขององค์ประกอบ
พารามิเตอร์แอตทริบิวต์ที่ระบุต้องเป็นออบเจ็กต์ที่ชื่อพร็อพเพอร์ตี้แต่ละรายการเป็นรายการในการแจกแจง DocumentApp.Attribute
และค่าพร็อพเพอร์ตี้แต่ละรายการคือค่าใหม่ที่จะใช้
var body = DocumentApp.getActiveDocument().getBody(); // Define a custom paragraph style. var style = {}; style[DocumentApp.Attribute.HORIZONTAL_ALIGNMENT] = DocumentApp.HorizontalAlignment.RIGHT; style[DocumentApp.Attribute.FONT_FAMILY] = 'Calibri'; style[DocumentApp.Attribute.FONT_SIZE] = 18; style[DocumentApp.Attribute.BOLD] = true; // Append a plain paragraph. var par = body.appendParagraph('A paragraph with custom style.'); // Apply the custom style. par.setAttributes(style);
พารามิเตอร์
ชื่อ | ประเภท | คำอธิบาย |
---|---|---|
attributes | Object | แอตทริบิวต์'s |
ไปกลับ
Footnote
— องค์ประกอบปัจจุบัน
การให้สิทธิ์
สคริปต์ที่ใช้วิธีนี้ต้องได้รับสิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents