ออบเจ็กต์ที่แสดงถึงบุ๊กมาร์ก
const doc = DocumentApp.getActiveDocument(); const documentTab = doc.getActiveTab().asDocumentTab(); // Insert a bookmark at the cursor position (in the active tab) and log its ID. const cursor = doc.getCursor(); const bookmark = documentTab.addBookmark(cursor); Logger.log(bookmark.getId());
เมธอด
| วิธีการ | ประเภทการแสดงผล | รายละเอียดแบบย่อ |
|---|---|---|
get | String | รับรหัสของ Bookmark |
get | Position | รับ Position ของ Bookmark ภายใน Document |
remove() | void | ลบ Bookmark |
เอกสารประกอบโดยละเอียด
get Id()
รับรหัสของ Bookmark รหัสนี้จะไม่ซ้ำกันภายใน Document
รีเทิร์น
String — รหัสของ Bookmark ซึ่งไม่ซ้ำกันภายใน Document
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/documents.currentonly -
https://www.googleapis.com/auth/documents
get Position()
รับ Position ของ Bookmark ภายใน Document Position จะยังคงถูกต้องตราบใดที่Bookmarkไม่ถูกลบ แม้ว่าสคริปต์จะเปลี่ยนโครงสร้างเอกสารก็ตาม
รีเทิร์น
Position — ตำแหน่งของ Bookmark
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/documents.currentonly -
https://www.googleapis.com/auth/documents
remove()
ลบ Bookmark การเรียกใช้เมธอดนี้กับ Bookmark ที่ลบไปแล้วจะไม่มีผล
การให้สิทธิ์
สคริปต์ที่ใช้วิธีการนี้ต้องได้รับอนุญาตด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ
-
https://www.googleapis.com/auth/documents.currentonly -
https://www.googleapis.com/auth/documents