代表書籤的物件。
// Insert a bookmark at the cursor position and log its ID. var doc = DocumentApp.getActiveDocument(); var cursor = doc.getCursor(); var bookmark = doc.addBookmark(cursor); Logger.log(bookmark.getId());
方法
方法 | 傳回類型 | 簡短說明 |
---|---|---|
getId() | String | 取得 Bookmark 的 ID。 |
getPosition() | Position | 取得 Document 中 Bookmark 的 Position 。 |
remove() | void | 刪除 Bookmark 。 |
內容詳盡的說明文件
getId()
取得 Bookmark
的 ID。文件內的 ID 不會重複。
回攻員
String
:Bookmark
的 ID,在文件中不得重複
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getPosition()
remove()
刪除 Bookmark
。如果對已經刪除的 Bookmark
呼叫這個方法,就不會產生任何影響。
授權
使用這個方法的指令碼必須取得以下一或多個範圍的授權:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents