टेबल की लाइन दिखाने वाला एलिमेंट. Table
हमेशा Table
में होता है और इसमें सिर्फ़ Table
एलिमेंट हो सकते हैं. दस्तावेज़ के स्ट्रक्चर के बारे में ज़्यादा जानने के लिए, Google Docs का इस्तेमाल करने के बारे में गाइड देखें.
तरीके
तरीका | रिटर्न टाइप | संक्षिप्त विवरण |
---|---|---|
append | Table | नया Table बनाता है और उसे जोड़ता है. |
append | Table | दिए गए टेक्स्ट वाले Table को जोड़ता है. |
append | Table | दिए गए Table को जोड़ता है. |
clear() | Table | एलिमेंट का कॉन्टेंट हटा देता है. |
copy() | Table | मौजूदा एलिमेंट की डीप कॉपी दिखाता है. |
edit | Text | बदलाव करने के लिए, मौजूदा एलिमेंट का Text वर्शन पाता है. |
find | Range | एलिमेंट के कॉन्टेंट में, बताए गए टाइप के डिसेंटेंट को खोजता है. |
find | Range | एलिमेंट के कॉन्टेंट में, तय किए गए Range से शुरू होकर, तय किए गए टाइप के डिसेंटेंट को खोजता है. |
find | Range | रेगुलर एक्सप्रेशन का इस्तेमाल करके, एलिमेंट के कॉन्टेंट में दिए गए टेक्स्ट पैटर्न को खोजता है. |
find | Range | किसी खोज के नतीजे से शुरू करके, एलिमेंट के कॉन्टेंट में दिए गए टेक्स्ट पैटर्न को खोजता है. |
get | Object | एलिमेंट के एट्रिब्यूट दिखाता है. |
get | Table | दिए गए सेल इंडेक्स पर मौजूद Table को दिखाता है. |
get | Element | बताए गए चाइल्ड इंडेक्स पर चाइल्ड एलिमेंट को वापस लाता है. |
get | Integer | बताए गए चाइल्ड एलिमेंट के लिए चाइल्ड इंडेक्स को वापस लाता है. |
get | String | लिंक का यूआरएल दिखाता है. |
get | Number | पॉइंट में, कम से कम ऊंचाई दिखाता है. |
get | Element | एलिमेंट के अगले सिबलिंग एलिमेंट को वापस लाता है. |
get | Integer | पंक्ति में मौजूद सेल की संख्या दिखाता है. |
get | Integer | बच्चों की संख्या दिखाता है. |
get | Container | एलिमेंट का पैरंट एलिमेंट दिखाता है. |
get | Table | मौजूदा पंक्ति वाले Table को दिखाता है. |
get | Element | एलिमेंट के पिछले सिबलिंग एलिमेंट को वापस लाता है. |
get | String | एलिमेंट के कॉन्टेंट को टेक्स्ट स्ट्रिंग के तौर पर दिखाता है. |
get | Text | टेक्स्ट अलाइनमेंट की जानकारी मिलती है. |
get | Element | एलिमेंट का Element दिखाता है. |
insert | Table | तय किए गए इंडेक्स पर एक नया Table बनाता है और उसे डालता है. |
insert | Table | दिए गए इंडेक्स में, दिया गया Table डालता है. इसमें दिया गया टेक्स्ट शामिल होता है. |
insert | Table | दिए गए इंडेक्स में, दिया गया Table डालता है. |
is | Boolean | यह तय करता है कि एलिमेंट, Document के आखिर में है या नहीं. |
merge() | Table | एलिमेंट को उसी टाइप के पिछले सिबलिंग के साथ मर्ज करता है. |
remove | Table | दिए गए सेल इंडेक्स से Table को हटाता है. |
remove | Table | चुने गए चाइल्ड एलिमेंट को हटाता है. |
remove | Table | एलिमेंट को उसके पैरंट से हटाता है. |
replace | Element | रेगुलर एक्सप्रेशन का इस्तेमाल करके, किसी दिए गए टेक्स्ट पैटर्न की सभी जगहों पर, दी गई रिप्लेसमेंट स्ट्रिंग से बदल देता है. |
set | Table | एलिमेंट के एट्रिब्यूट सेट करता है. |
set | Table | लिंक का यूआरएल सेट करता है. |
set | Table | पॉइंट में, कम से कम ऊंचाई सेट करता है. |
set | Table | टेक्स्ट अलाइनमेंट सेट करता है. |
ज़्यादा जानकारी वाला दस्तावेज़
appendTableCell()
appendTableCell(textContents)
दिए गए टेक्स्ट वाले Table
को जोड़ता है.
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
text | String | सेल का टेक्स्ट कॉन्टेंट |
वापसी का टिकट
Table
— जोड़ा गया टेबल सेल एलिमेंट
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
appendTableCell(tableCell)
दिए गए Table
को जोड़ता है.
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
table | Table | टेबल सेल जोड़ना |
वापसी का टिकट
Table
— जोड़ी गई टेबल सेल
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
clear()
copy()
मौजूदा एलिमेंट की डीप कॉपी दिखाता है.
एलिमेंट में मौजूद सभी चाइल्ड एलिमेंट भी कॉपी हो जाते हैं. नए एलिमेंट का कोई पैरंट नहीं है.
वापसी का टिकट
Table
— नई कॉपी.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
editAsText()
बदलाव करने के लिए, मौजूदा एलिमेंट का Text
वर्शन पाता है.
एलिमेंट के कॉन्टेंट को रिच टेक्स्ट के तौर पर मैनिप्युलेट करने के लिए, edit
का इस्तेमाल करें. edit
मोड, टेक्स्ट के अलावा अन्य एलिमेंट (जैसे, Inline
और Horizontal
) को अनदेखा करता है.
मिटाए गए टेक्स्ट की रेंज में पूरी तरह से शामिल चाइल्ड एलिमेंट, एलिमेंट से हटा दिए जाते हैं.
const body = DocumentApp.getActiveDocument().getActiveTab().asDocumentTab().getBody(); // Insert two paragraphs separated by a paragraph containing an // horizontal rule. body.insertParagraph(0, 'An editAsText sample.'); body.insertHorizontalRule(0); body.insertParagraph(0, 'An example.'); // Delete " sample.\n\n An" removing the horizontal rule in the process. body.editAsText().deleteText(14, 25);
वापसी का टिकट
Text
— मौजूदा एलिमेंट का टेक्स्ट वर्शन
findElement(elementType)
एलिमेंट के कॉन्टेंट में, बताए गए टाइप के डिसेंटेंट को खोजता है.
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
element | Element | खोजने के लिए एलिमेंट का टाइप. |
वापसी का टिकट
Range
— खोज के नतीजे में, खोज एलिमेंट की रैंकिंग दिखाने वाला एलिमेंट.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
findElement(elementType, from)
एलिमेंट के कॉन्टेंट में, तय किए गए Range
से शुरू होकर, तय किए गए टाइप के डिसेंटेंट को खोजता है.
const body = DocumentApp.getActiveDocument().getActiveTab().asDocumentTab().getBody(); // Define the search parameters. let searchResult = null; // Search until the paragraph is found. while ( (searchResult = body.findElement( DocumentApp.ElementType.PARAGRAPH, searchResult, ))) { const par = searchResult.getElement().asParagraph(); if (par.getHeading() === DocumentApp.ParagraphHeading.HEADING1) { // Found one, update and stop. par.setText('This is the first header.'); break; } }
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
element | Element | खोजने के लिए एलिमेंट का टाइप. |
from | Range | खोज के लिए इस्तेमाल किया जाने वाला नतीजा. |
वापसी का टिकट
Range
— खोज के नतीजे में, खोज एलिमेंट की अगली रैंकिंग की जानकारी देने वाला एलिमेंट.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
findText(searchPattern)
रेगुलर एक्सप्रेशन का इस्तेमाल करके, एलिमेंट के कॉन्टेंट में दिए गए टेक्स्ट पैटर्न को खोजता है.
JavaScript रेगुलर एक्सप्रेशन की कुछ सुविधाएं पूरी तरह काम नहीं करतीं. जैसे, कैप्चर ग्रुप और मोड मॉडिफ़ायर.
दिए गए रेगुलर एक्सप्रेशन पैटर्न का मिलान, मौजूदा एलिमेंट में मौजूद हर टेक्स्ट ब्लॉक से अलग-अलग किया जाता है.
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
search | String | खोजने के लिए पैटर्न |
वापसी का टिकट
Range
— खोज के नतीजे में, खोज के लिए इस्तेमाल हुए टेक्स्ट की पोज़िशन दिखती है. अगर कोई मैच नहीं मिलता है, तो यह वैल्यू शून्य होती है
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
findText(searchPattern, from)
किसी खोज के नतीजे से शुरू करके, एलिमेंट के कॉन्टेंट में दिए गए टेक्स्ट पैटर्न को खोजता है.
JavaScript रेगुलर एक्सप्रेशन की कुछ सुविधाएं पूरी तरह काम नहीं करतीं. जैसे, कैप्चर ग्रुप और मोड मॉडिफ़ायर.
दिए गए रेगुलर एक्सप्रेशन पैटर्न का मिलान, मौजूदा एलिमेंट में मौजूद हर टेक्स्ट ब्लॉक से अलग-अलग किया जाता है.
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
search | String | खोजने के लिए पैटर्न |
from | Range | खोज के जिस नतीजे में खोजना है |
वापसी का टिकट
Range
— खोज के नतीजे में, खोज के लिए इस्तेमाल हुए टेक्स्ट की अगली पोज़िशन दिखती है. अगर कोई मैच नहीं मिलता है, तो यह वैल्यू शून्य होती है
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getAttributes()
एलिमेंट के एट्रिब्यूट दिखाता है.
इसका नतीजा एक ऑब्जेक्ट होता है, जिसमें हर मान्य एलिमेंट एट्रिब्यूट के लिए एक प्रॉपर्टी होती है. इसमें हर प्रॉपर्टी का नाम, Document
एनोटेशन में मौजूद किसी आइटम से मेल खाता है.
const doc = DocumentApp.getActiveDocument(); const documentTab = doc.getActiveTab().asDocumentTab(); const body = documentTab.getBody(); // Append a styled paragraph. const par = body.appendParagraph('A bold, italicized paragraph.'); par.setBold(true); par.setItalic(true); // Retrieve the paragraph's attributes. const atts = par.getAttributes(); // Log the paragraph attributes. for (const att in atts) { Logger.log(`${att}:${atts[att]}`); }
वापसी का टिकट
Object
— एलिमेंट के एट्रिब्यूट.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getCell(cellIndex)
दिए गए सेल इंडेक्स पर मौजूद Table
को दिखाता है.
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
cell | Integer | जिस सेल की वैल्यू वापस लानी है उसका इंडेक्स |
वापसी का टिकट
Table
— टेबल सेल
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getChild(childIndex)
बताए गए चाइल्ड इंडेक्स पर चाइल्ड एलिमेंट को वापस लाता है.
const body = DocumentApp.getActiveDocument().getActiveTab().asDocumentTab().getBody(); // Obtain the first element in the tab. const firstChild = body.getChild(0); // If it's a paragraph, set its contents. if (firstChild.getType() === DocumentApp.ElementType.PARAGRAPH) { firstChild.asParagraph().setText('This is the first paragraph.'); }
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
child | Integer | जिस चाइल्ड एलिमेंट को वापस लाना है उसका इंडेक्स. |
वापसी का टिकट
Element
— तय किए गए इंडेक्स पर मौजूद चाइल्ड एलिमेंट.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getChildIndex(child)
बताए गए चाइल्ड एलिमेंट के लिए चाइल्ड इंडेक्स को वापस लाता है.
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
child | Element | वह चाइल्ड एलिमेंट जिसके लिए इंडेक्स को वापस लाना है. |
वापसी का टिकट
Integer
— चाइल्ड इंडेक्स.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getLinkUrl()
लिंक का यूआरएल दिखाता है.
वापसी का टिकट
String
— लिंक का यूआरएल या अगर एलिमेंट में इस एट्रिब्यूट के लिए एक से ज़्यादा वैल्यू हैं, तो शून्य
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getMinimumHeight()
पॉइंट में, कम से कम ऊंचाई दिखाता है.
वापसी का टिकट
Number
— पॉइंट में कम से कम ऊंचाई
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getNextSibling()
एलिमेंट के अगले सिबलिंग एलिमेंट को वापस लाता है.
अगले सिबलिंग का पैरंट एक ही होता है और वह मौजूदा एलिमेंट के बाद आता है.
वापसी का टिकट
Element
— अगला सिबलिंग एलिमेंट.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getNumCells()
पंक्ति में मौजूद सेल की संख्या दिखाता है.
वापसी का टिकट
Integer
— सेल की संख्या
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getNumChildren()
बच्चों की संख्या दिखाता है.
const body = DocumentApp.getActiveDocument().getActiveTab().asDocumentTab().getBody(); // Log the number of elements in the tab. Logger.log(`There are ${body.getNumChildren()} elements in the tab's body.`);
वापसी का टिकट
Integer
— बच्चों की संख्या.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getParent()
एलिमेंट का पैरंट एलिमेंट दिखाता है.
पैरंट एलिमेंट में मौजूदा एलिमेंट होता है.
वापसी का टिकट
Container
— पैरंट एलिमेंट.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getParentTable()
मौजूदा पंक्ति वाले Table
को दिखाता है.
वापसी का टिकट
Table
— वह टेबल जिसमें मौजूदा लाइन है
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getPreviousSibling()
एलिमेंट के पिछले सिबलिंग एलिमेंट को वापस लाता है.
पिछले सिबलिंग का पैरंट एक ही है और वह मौजूदा एलिमेंट से पहले आता है.
वापसी का टिकट
Element
— सिबलिंग एलिमेंट का पिछला एलिमेंट.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getText()
एलिमेंट के कॉन्टेंट को टेक्स्ट स्ट्रिंग के तौर पर दिखाता है.
वापसी का टिकट
String
— टेक्स्ट स्ट्रिंग के तौर पर एलिमेंट का कॉन्टेंट
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getTextAlignment()
टेक्स्ट अलाइनमेंट की जानकारी मिलती है. अलाइनमेंट के लिए ये टाइप उपलब्ध हैं: Document
, Document
, और Document
.
वापसी का टिकट
Text
— टेक्स्ट अलाइनमेंट का टाइप या null
, अगर टेक्स्ट में एक से ज़्यादा तरह के टेक्स्ट अलाइनमेंट हैं या टेक्स्ट अलाइनमेंट कभी सेट नहीं किया गया है
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getType()
एलिमेंट का Element
दिखाता है.
किसी एलिमेंट के टाइप का सटीक पता लगाने के लिए, get
का इस्तेमाल करें.
const doc = DocumentApp.getActiveDocument(); const documentTab = doc.getActiveTab().asDocumentTab(); const body = documentTab.getBody(); // Obtain the first element in the active tab's body. const 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.'); }
वापसी का टिकट
Element
— एलिमेंट का टाइप.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
insertTableCell(childIndex)
तय किए गए इंडेक्स पर एक नया Table
बनाता है और उसे डालता है.
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
child | Integer | वह इंडेक्स जहां एलिमेंट डालना है |
वापसी का टिकट
Table
— नई टेबल सेल
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
insertTableCell(childIndex, textContents)
दिए गए इंडेक्स में, दिया गया Table
डालता है. इसमें दिया गया टेक्स्ट शामिल होता है.
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
child | Integer | वह इंडेक्स जहां एलिमेंट डालना है |
text | String | सेल का टेक्स्ट कॉन्टेंट |
वापसी का टिकट
Table
— शामिल की गई टेबल सेल
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
insertTableCell(childIndex, tableCell)
दिए गए इंडेक्स में, दिया गया Table
डालता है.
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
child | Integer | वह इंडेक्स जहां एलिमेंट डालना है |
table | Table | टेबल सेल डालने के लिए |
वापसी का टिकट
Table
— शामिल की गई टेबल सेल
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
isAtDocumentEnd()
यह तय करता है कि एलिमेंट, Document
के आखिर में है या नहीं.
वापसी का टिकट
Boolean
— एलिमेंट, टैब के आखिर में है या नहीं.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
merge()
एलिमेंट को उसी टाइप के पिछले सिबलिंग के साथ मर्ज करता है.
सिर्फ़ एक ही Element
के एलिमेंट मर्ज किए जा सकते हैं. मौजूदा एलिमेंट में मौजूद सभी चाइल्ड एलिमेंट, उससे पहले वाले सिबलिंग एलिमेंट में ले जाए जाते हैं.
मौजूदा एलिमेंट को दस्तावेज़ से हटा दिया जाता है.
const doc = DocumentApp.getActiveDocument(); const documentTab = doc.getActiveTab().asDocumentTab(); const body = documentTab.getBody(); // Example 1: Merge paragraphs // Append two paragraphs to the document's active tab. const par1 = body.appendParagraph('Paragraph 1.'); const par2 = body.appendParagraph('Paragraph 2.'); // Merge the newly added paragraphs into a single paragraph. par2.merge(); // Example 2: Merge table cells // Create a two-dimensional array containing the table's cell contents. const cells = [ ['Row 1, Cell 1', 'Row 1, Cell 2'], ['Row 2, Cell 1', 'Row 2, Cell 2'], ]; // Build a table from the array. const table = body.appendTable(cells); // Get the first row in the table. const row = table.getRow(0); // Get the two cells in this row. const cell1 = row.getCell(0); const cell2 = row.getCell(1); // Merge the current cell into its preceding sibling element. const merged = cell2.merge();
वापसी का टिकट
Table
— मर्ज किया गया एलिमेंट.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
removeCell(cellIndex)
दिए गए सेल इंडेक्स से Table
को हटाता है.
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
cell | Integer | जिस सेल को हटाना है उसका इंडेक्स |
वापसी का टिकट
Table
— हटाई गई सेल
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
removeChild(child)
चुने गए चाइल्ड एलिमेंट को हटाता है.
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
child | Element | जिस चाइल्ड एलिमेंट को हटाना है |
वापसी का टिकट
Table
— मौजूदा एलिमेंट
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
removeFromParent()
एलिमेंट को उसके पैरंट से हटाता है.
const doc = DocumentApp.getActiveDocument(); const documentTab = doc.getActiveTab().asDocumentTab(); const body = documentTab.getBody(); // Remove all images in the active tab's body. const imgs = body.getImages(); for (let i = 0; i < imgs.length; i++) { imgs[i].removeFromParent(); }
वापसी का टिकट
Table
— हटाया गया एलिमेंट.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
replaceText(searchPattern, replacement)
रेगुलर एक्सप्रेशन का इस्तेमाल करके, किसी दिए गए टेक्स्ट पैटर्न की सभी जगहों पर, दी गई रिप्लेसमेंट स्ट्रिंग से बदल देता है.
खोज पैटर्न को JavaScript रेगुलर एक्सप्रेशन ऑब्जेक्ट के बजाय, स्ट्रिंग के तौर पर पास किया जाता है. इसलिए, आपको पैटर्न में मौजूद किसी भी बैकस्लैश को एस्केप करना होगा.
इस तरीके में, Google की RE2 रेगुलर एक्सप्रेशन लाइब्रेरी का इस्तेमाल किया जाता है. इससे, काम करने वाले सिंटैक्स की संख्या सीमित हो जाती है.
दिए गए रेगुलर एक्सप्रेशन पैटर्न का मिलान, मौजूदा एलिमेंट में मौजूद हर टेक्स्ट ब्लॉक से अलग-अलग किया जाता है.
const body = DocumentApp.getActiveDocument().getActiveTab().asDocumentTab().getBody(); // Clear the text surrounding "Apps Script", with or without text. body.replaceText('^.*Apps ?Script.*$', 'Apps Script');
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
search | String | खोजने के लिए रेगुलर एक्सप्रेशन पैटर्न |
replacement | String | वह टेक्स्ट जिसे बदलने के लिए इस्तेमाल करना है |
वापसी का टिकट
Element
— मौजूदा एलिमेंट
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
setAttributes(attributes)
एलिमेंट के एट्रिब्यूट सेट करता है.
एट्रिब्यूट पैरामीटर, एक ऑब्जेक्ट होना चाहिए. इसमें हर प्रॉपर्टी का नाम, Document
एनोटेशन में मौजूद किसी आइटम के तौर पर होना चाहिए. साथ ही, हर प्रॉपर्टी की वैल्यू, लागू की जाने वाली नई वैल्यू होनी चाहिए.
const doc = DocumentApp.getActiveDocument(); const documentTab = doc.getActiveTab().asDocumentTab(); const body = documentTab.getBody(); // Define a custom paragraph style. const 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. const par = body.appendParagraph('A paragraph with custom style.'); // Apply the custom style. par.setAttributes(style);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
attributes | Object | एलिमेंट के एट्रिब्यूट. |
वापसी का टिकट
Table
— मौजूदा एलिमेंट.
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
setLinkUrl(url)
लिंक का यूआरएल सेट करता है.
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
url | String | लिंक का यूआरएल |
वापसी का टिकट
Table
— मौजूदा एलिमेंट
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
setMinimumHeight(minHeight)
पॉइंट में, कम से कम ऊंचाई सेट करता है.
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
min | Number | पॉइंट में कम से कम ऊंचाई |
वापसी का टिकट
Table
— मौजूदा एलिमेंट
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
setTextAlignment(textAlignment)
टेक्स्ट अलाइनमेंट सेट करता है. अलाइनमेंट के लिए ये टाइप उपलब्ध हैं: Document
, Document
, और Document
.
// Make the entire first paragraph in the active tab be superscript. const documentTab = DocumentApp.getActiveDocument().getActiveTab().asDocumentTab(); const text = documentTab.getBody().getParagraphs()[0].editAsText(); text.setTextAlignment(DocumentApp.TextAlignment.SUPERSCRIPT);
पैरामीटर
नाम | टाइप | ब्यौरा |
---|---|---|
text | Text | लागू करने के लिए टेक्स्ट अलाइनमेंट का टाइप |
वापसी का टिकट
Table
— मौजूदा एलिमेंट
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट को, इनमें से एक या एक से ज़्यादा स्कोप के लिए अनुमति की ज़रूरत होती है:
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents