Class Bookmark
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
बुकमार्क करना
बुकमार्क दिखाने वाला ऑब्जेक्ट.
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());
ज़्यादा जानकारी वाला दस्तावेज़
getId()
Bookmark
का आईडी पाता है. यह आईडी, DocumentTab
में यूनीक होता है.
वापसी का टिकट
String
— Bookmark
का आईडी, जो DocumentTab
में यूनीक होता है.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getPosition()
DocumentTab
में मौजूद Bookmark
का Position
दिखाता है. जब तक Bookmark
को मिटाया नहीं जाता, तब तक Position
सटीक रहता है. भले ही, स्क्रिप्ट से दस्तावेज़ का स्ट्रक्चर बदल जाए.
वापसी का टिकट
Position
— Bookmark
की स्थिति.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
remove()
Bookmark
को मिटाता है. पहले से मिट चुके Bookmark
पर इस तरीके का इस्तेमाल करने से कोई असर नहीं पड़ता.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eA Bookmark object represents a specific location within a Google Doc, allowing you to programmatically interact with it.\u003c/p\u003e\n"],["\u003cp\u003eYou can create a Bookmark using the \u003ccode\u003eaddBookmark()\u003c/code\u003e method of a DocumentTab, inserting it at the current cursor position.\u003c/p\u003e\n"],["\u003cp\u003eBookmarks offer methods to retrieve their unique ID (\u003ccode\u003egetId()\u003c/code\u003e), get their position within the document (\u003ccode\u003egetPosition()\u003c/code\u003e), and remove them (\u003ccode\u003eremove()\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eBookmark positions remain valid even after document modifications, unless the bookmark itself is deleted.\u003c/p\u003e\n"]]],[],null,["# Class Bookmark\n\nBookmark\n\nAn object representing a bookmark.\n\n```javascript\nconst doc = DocumentApp.getActiveDocument();\nconst documentTab = doc.getActiveTab().asDocumentTab();\n\n// Insert a bookmark at the cursor position (in the active tab) and log its ID.\nconst cursor = doc.getCursor();\nconst bookmark = documentTab.addBookmark(cursor);\nLogger.log(bookmark.getId());\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [getId()](#getId()) | `String` | Gets the ID of the `Bookmark`. |\n| [getPosition()](#getPosition()) | [Position](/apps-script/reference/document/position) | Gets the [Position](/apps-script/reference/document/position) of the `Bookmark` within the [DocumentTab](/apps-script/reference/document/document-tab). |\n| [remove()](#remove()) | `void` | Deletes the `Bookmark`. |\n\nDetailed documentation\n----------------------\n\n### `get``Id()`\n\nGets the ID of the `Bookmark`. The ID is unique within the [DocumentTab](/apps-script/reference/document/document-tab).\n\n#### Return\n\n\n`String` --- The `Bookmark`'s ID, which is unique within the `Document``Tab`.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/documents.currentonly`\n- `https://www.googleapis.com/auth/documents`\n\n*** ** * ** ***\n\n### `get``Position()`\n\nGets the [Position](/apps-script/reference/document/position) of the `Bookmark` within the [DocumentTab](/apps-script/reference/document/document-tab). The `Position` remains accurate so long as the `Bookmark` is not deleted, even if the script\nchanges the document structure.\n\n#### Return\n\n\n[Position](/apps-script/reference/document/position) --- The position of the `Bookmark`.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/documents.currentonly`\n- `https://www.googleapis.com/auth/documents`\n\n*** ** * ** ***\n\n### `remove()`\n\nDeletes the `Bookmark`. Calling this method on a `Bookmark` that has already been\ndeleted has no effect.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/documents.currentonly`\n- `https://www.googleapis.com/auth/documents`"]]