Class Paragraph

पैराग्राफ़

पैराग्राफ़ को दिखाने वाला एलिमेंट. Paragraph में Equation, Footnote, HorizontalRule, InlineDrawing, InlineImage, PageBreak, और Text एलिमेंट शामिल हो सकते हैं. दस्तावेज़ के स्ट्रक्चर के बारे में ज़्यादा जानकारी के लिए, Google Docs का विस्तार करने के लिए गाइड देखें.

Paragraphs में नई पंक्ति के वर्ण नहीं हो सकते. नए-लाइन वाले वर्ण ("\n") लाइन-ब्रेक वर्णों ("इनमें मौजूद हैं") में बदल दिए जाते हैं.

var body = DocumentApp.getActiveDocument().getBody();

// Append a document header paragraph.
var header = body.appendParagraph("A Document");
header.setHeading(DocumentApp.ParagraphHeading.HEADING1);

// Append a section header paragraph.
var section = body.appendParagraph("Section 1");
section.setHeading(DocumentApp.ParagraphHeading.HEADING2);

// Append a regular paragraph.
body.appendParagraph("This is a typical paragraph.");

तरीके

तरीकारिटर्न टाइपसंक्षिप्त विवरण
addPositionedImage(image)PositionedImageतय किए गए इमेज ब्लॉब से नया PositionedImage बनाता और जोड़ता है.
appendHorizontalRule()HorizontalRuleनया HorizontalRule बनाता और जोड़ता है.
appendInlineImage(image)InlineImageतय किए गए इमेज ब्लॉब से नया InlineImage बनाता और जोड़ता है.
appendInlineImage(image)InlineImageदिए गए InlineImage को जोड़ता है.
appendPageBreak()PageBreakनया PageBreak बनाता और जोड़ता है.
appendPageBreak(pageBreak)PageBreakदिए गए PageBreak को जोड़ता है.
appendText(text)Textबताए गए कॉन्टेंट के साथ नया Text एलिमेंट बनाता और जोड़ता है.
appendText(text)Textदिया गया Text एलिमेंट जोड़ता है.
clear()Paragraphऐसा करने से, एलिमेंट का कॉन्टेंट मिट जाएगा.
copy()Paragraphमौजूदा एलिमेंट की अलग की गई डीप कॉपी दिखाता है.
editAsText()Textबदलाव करने के लिए, मौजूदा एलिमेंट का Text वर्शन पाएं.
findElement(elementType)RangeElementकिसी खास तरह के डिसेंडेंट के लिए, एलिमेंट के कॉन्टेंट की खोज करता है.
findElement(elementType, from)RangeElementRangeElement से शुरू होने वाले किसी खास तरह के डिसेंडेंट के लिए, एलिमेंट के कॉन्टेंट की खोज करता है.
findText(searchPattern)RangeElementरेगुलर एक्सप्रेशन का इस्तेमाल करके, बताए गए टेक्स्ट पैटर्न के लिए एलिमेंट के कॉन्टेंट की खोज करता है.
findText(searchPattern, from)RangeElementदिए गए खोज के नतीजे से शुरू करके, बताए गए टेक्स्ट पैटर्न के लिए एलिमेंट के कॉन्टेंट की खोज करता है.
getAlignment()HorizontalAlignmentHorizontalAlignment को वापस लाता है.
getAttributes()Objectएलिमेंट के एट्रिब्यूट बताता है.
getChild(childIndex)Elementतय किए गए चाइल्ड इंडेक्स से चाइल्ड एलिमेंट दिखाता है.
getChildIndex(child)Integerतय किए गए चाइल्ड एलिमेंट के लिए, चाइल्ड इंडेक्स को फिर से दिखाता है.
getHeading()ParagraphHeadingParagraphHeading को वापस लाता है.
getIndentEnd()Numberयह, इंडेंटेशन को पॉइंट में वापस लाता है.
getIndentFirstLine()Numberपॉइंट में, पहली लाइन इंडेंट हासिल करता है.
getIndentStart()Numberप्रारंभ इंडेंट फिर से मिलता है.
getLineSpacing()Numberपंक्ति के बीच की दूरी को फिर से पॉइंट में लाता है.
getLinkUrl()Stringलिंक यूआरएल वापस लाता है.
getNextSibling()Elementएलिमेंट के अगले सिबलिंग एलिमेंट को वापस लाता है.
getNumChildren()Integerबच्चों की संख्या दिखाता है.
getParent()ContainerElementएलिमेंट के पैरंट एलिमेंट को वापस लाता है.
getPositionedImage(id)PositionedImageइमेज के आईडी का इस्तेमाल करके, PositionedImage पाएं.
getPositionedImages()PositionedImage[]पैराग्राफ़ में ऐंकर किए गए सभी PositionedImage ऑब्जेक्ट दिखाता है.
getPreviousSibling()Elementएलिमेंट के पिछले सिबलिंग एलिमेंट को वापस लाता है.
getSpacingAfter()Numberएलिमेंट के बाद, पॉइंट में स्पेसिंग को फिर से सेट करता है.
getSpacingBefore()Numberएलिमेंट से पहले, पॉइंट में स्पेसिंग को फिर से सेट करता है.
getText()Stringयह एलिमेंट के कॉन्टेंट को टेक्स्ट स्ट्रिंग के तौर पर फ़ेच करता है.
getTextAlignment()TextAlignmentटेक्स्ट अलाइनमेंट हासिल करता है.
getType()ElementTypeएलिमेंट की ElementType दिखाता है.
insertHorizontalRule(childIndex)HorizontalRuleतय इंडेक्स में HorizontalRule बनाता और शामिल करता है.
insertInlineImage(childIndex, image)InlineImageतय इंडेक्स में, तय किए गए इमेज BLOB से एक नया InlineImage बनाता और शामिल करता है.
insertInlineImage(childIndex, image)InlineImageबताए गए इंडेक्स में दिया गया InlineImage डालता है.
insertPageBreak(childIndex)PageBreakतय इंडेक्स में नया PageBreak बनाता और शामिल करता है.
insertPageBreak(childIndex, pageBreak)PageBreakबताए गए इंडेक्स में दिया गया PageBreak डालता है.
insertText(childIndex, text)Textतय किए गए इंडेक्स में नया टेक्स्ट एलिमेंट बनाता है और उसे शामिल करता है.
insertText(childIndex, text)Textबताए गए इंडेक्स पर, दिया गया Text एलिमेंट शामिल करता है.
isAtDocumentEnd()Booleanइससे पता चलता है कि एलिमेंट Document के आखिर में है या नहीं.
isLeftToRight()Booleanबाईं-से-दाईं सेटिंग को फिर से हासिल करता है.
merge()Paragraphएलिमेंट को इसी तरह के पिछले सिबलिंग के साथ मर्ज करता है.
removeChild(child)Paragraphबताए गए चाइल्ड एलिमेंट को हटाता है.
removeFromParent()Paragraphएलिमेंट को उसके पैरंट एलिमेंट से हटा देता है.
removePositionedImage(id)Booleanइमेज के आईडी के ज़रिए PositionedImage हटा देता है.
replaceText(searchPattern, replacement)Elementरेगुलर एक्सप्रेशन का इस्तेमाल करके, किसी दिए गए टेक्स्ट पैटर्न की सभी घटनाओं को किसी बदली गई स्ट्रिंग से बदलता है.
setAlignment(alignment)ParagraphHorizontalAlignment सेट करें.
setAttributes(attributes)Paragraphएलिमेंट के एट्रिब्यूट सेट करता है.
setHeading(heading)ParagraphParagraphHeading सेट करें.
setIndentEnd(indentEnd)Paragraphएंड इंडेंटेशन को पॉइंट में सेट करता है.
setIndentFirstLine(indentFirstLine)Paragraphपॉइंट में पहला लाइन इंडेंट सेट करता है.
setIndentStart(indentStart)Paragraphशुरुआत का इंडेंट, पॉइंट में सेट करता है.
setLeftToRight(leftToRight)Paragraphबाएं-से-दाएं सेटिंग सेट करता है.
setLineSpacing(multiplier)Paragraphलाइनों के बीच की दूरी को तय करने वाली संख्या के तौर पर लाइन स्पेसिंग सेट करता है.
setLinkUrl(url)Paragraphलिंक यूआरएल सेट करता है.
setSpacingAfter(spacingAfter)Paragraphएलिमेंट के बाद, पॉइंट में स्पेसिंग सेट करता है.
setSpacingBefore(spacingBefore)Paragraphएलिमेंट से पहले, पॉइंट में स्पेसिंग सेट करता है.
setText(text)voidपैराग्राफ़ की सामग्री को लेख के रूप में सेट करता है.
setTextAlignment(textAlignment)Paragraphटेक्स्ट अलाइनमेंट सेट करता है.

पूरी जानकारी वाला दस्तावेज़

addPositionedImage(image)

तय किए गए इमेज ब्लॉब से नया PositionedImage बनाता और जोड़ता है.

// Opens the Docs file by its ID. If you created your script from within
// a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('abc123456');

// Gets the document body.
const body = doc.getBody();

// Gets the first paragraph from the body.
const paragraph = body.getParagraphs()[0];

// Fetches the specified image URL.
const image =
  UrlFetchApp.fetch('https://fonts.gstatic.com/s/i/productlogos/apps_script/v10/web-24dp/logo_apps_script_color_1x_web_24dp.png');

// Adds the image to the document, anchored to the first paragraph.
paragraph.addPositionedImage(image);

पैरामीटर में

नामTypeजानकारी
imageBlobSourceइमेज डेटा.

वापसी की ट्रेन

PositionedImage — नई पोज़िशन की गई इमेज.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

appendHorizontalRule()

नया HorizontalRule बनाता और जोड़ता है.

// Opens the Docs file by its ID. If you created your script from within
// a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('abc123456');

// Gets the document body.
const body = doc.getBody();

// Gets the first paragraph from the body.
const paragraph = body.getParagraphs()[0];

// Adds a horizontal line under the first paragraph.
paragraph.appendHorizontalRule();

वापसी की ट्रेन

HorizontalRule — नया हॉरिज़ॉन्टल नियम.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

appendInlineImage(image)

तय किए गए इमेज ब्लॉब से नया InlineImage बनाता और जोड़ता है.

// Opens the Docs file by its ID. If you created your script from within
// a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('abc123456');

// Gets the document body.
const body = doc.getBody();

// Gets the first paragraph from the body.
const paragraph = body.getParagraphs()[0];

// Fetches the image from the specified image URL.
const image = UrlFetchApp
  .fetch('https://fonts.gstatic.com/s/i/productlogos/apps_script/v10/web-96dp/logo_apps_script_color_1x_web_96dp.png');

// Adds the image to the first paragraph.
paragraph.appendInlineImage(image);

पैरामीटर में

नामTypeजानकारी
imageBlobSourceइमेज डेटा.

वापसी की ट्रेन

InlineImage — जोड़ी गई इमेज.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

appendInlineImage(image)

दिए गए InlineImage को जोड़ता है.

// Opens the Docs file by its ID. If you created your script from within
// a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('abc123456');

// Gets the document body.
const body = doc.getBody();

// Gets the first paragraph from the body.
const paragraph = body.getParagraphs()[0];

// Makes a copy of the first image in the body.
const image = body.getImages()[0].copy();;

// Adds the image to the first paragraph.
paragraph.appendInlineImage(image);

पैरामीटर में

नामTypeजानकारी
imageInlineImageइमेज डेटा.

वापसी की ट्रेन

InlineImage — जोड़ी गई इमेज.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

appendPageBreak()

नया PageBreak बनाता और जोड़ता है.

ध्यान दें: हो सकता है कि PageBreaks को TableCells में शामिल न किया गया हो. अगर टेबल एलिमेंट में मौजूदा एलिमेंट शामिल है, तो अपवाद माना जाएगा.

// Opens the Docs file by its ID. If you created your script from within
// a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('abc123456');

// Gets the document body.
const body = doc.getBody();

// Gets the first paragraph from the body.
const paragraph = body.getParagraphs()[0];

// Adds a page break after the first paragraph.
paragraph.appendPageBreak();

वापसी की ट्रेन

PageBreak — नया पेज ब्रेक एलिमेंट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

appendPageBreak(pageBreak)

दिए गए PageBreak को जोड़ता है.

ध्यान दें: PageBreaks को TableCells में शामिल नहीं किया जा सकता. अगर टेबल एलिमेंट में मौजूदा एलिमेंट मौजूद है, तो स्क्रिप्ट अपवाद की जानकारी देती है.

// Opens the Docs file by its ID. If you created your script from within
// a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('abc123456');

// Gets the document body.
const body = doc.getBody();

// Gets the first paragraph from the body.
const paragraph = body.getParagraphs()[0];

// Adds a page break after the first paragraph.
const pageBreak = paragraph.appendPageBreak();

// Makes a copy of the page break.
const newPageBreak = pageBreak.copy();

// Adds the copied page break to the paragraph.
paragraph.appendPageBreak(newPageBreak);

पैरामीटर में

नामTypeजानकारी
pageBreakPageBreakजोड़ने के लिए पेज ब्रेक करें.

वापसी की ट्रेन

PageBreak — जोड़ा गया पेज ब्रेक एलिमेंट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

appendText(text)

बताए गए कॉन्टेंट के साथ नया Text एलिमेंट बनाता और जोड़ता है.

// Opens the Docs file by its ID. If you created your script from within
// a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('abc123456');

// Gets the document body.
const body = doc.getBody();

// Gets the first paragraph from the body.
const paragraph = body.getParagraphs()[0];

// Adds a string to the paragraph.
paragraph.appendText('This is a new sentence.');

पैरामीटर में

नामTypeजानकारी
textStringटेक्स्ट का कॉन्टेंट.

वापसी की ट्रेन

Text — नया टेक्स्ट एलिमेंट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

appendText(text)

दिया गया Text एलिमेंट जोड़ता है.

 // Opens the Docs file by its ID. If you created your script from within
// a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('abc123456');

// Gets the document body.
const body = doc.getBody();

// Gets the text from the first paragraph in the body.
const paragraph1 = body.getParagraphs()[0];
const text = paragraph1.getText();

// Gets the third paragraph in the body.
const paragraph3 = body.getParagraphs()[2];

// Adds the text from the first paragraph to the third paragraph.
paragraph3.appendText(text);

पैरामीटर में

नामTypeजानकारी
textTextजोड़ने के लिए टेक्स्ट एलिमेंट.

वापसी की ट्रेन

Text — जोड़ा गया टेक्स्ट एलिमेंट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

clear()

ऐसा करने से, एलिमेंट का कॉन्टेंट मिट जाएगा.

वापसी की ट्रेन

Paragraph — मौजूदा एलिमेंट


copy()

मौजूदा एलिमेंट की अलग की गई डीप कॉपी दिखाता है.

एलिमेंट में मौजूद चाइल्ड एलिमेंट भी कॉपी हो जाते हैं. नए एलिमेंट के लिए कोई पैरंट नहीं है.

वापसी की ट्रेन

Paragraph — नई कॉपी.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

editAsText()

बदलाव करने के लिए, मौजूदा एलिमेंट का Text वर्शन पाएं.

एलिमेंट के कॉन्टेंट को रिच टेक्स्ट के तौर पर दिखाने के लिए, editAsText का इस्तेमाल करें. editAsText मोड, बिना टेक्स्ट वाले एलिमेंट (जैसे InlineImage और HorizontalRule) को अनदेखा करता है.

मिटाए गए टेक्स्ट रेंज में जो चाइल्ड एलिमेंट पूरी तरह से शामिल होते हैं उन्हें एलिमेंट से हटा दिया जाता है.

var body = DocumentApp.getActiveDocument().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)

किसी खास तरह के डिसेंडेंट के लिए, एलिमेंट के कॉन्टेंट की खोज करता है.

पैरामीटर में

नामTypeजानकारी
elementTypeElementTypeखोजने के लिए एलीमेंट का प्रकार

वापसी की ट्रेन

RangeElement — खोज का नतीजा, जो खोज के नतीजे की जगह को दिखाता है

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

findElement(elementType, from)

RangeElement से शुरू होने वाले किसी खास तरह के डिसेंडेंट के लिए, एलिमेंट के कॉन्टेंट की खोज करता है.

// Get the body section of the active document.
var body = DocumentApp.getActiveDocument().getBody();

// Define the search parameters.
var searchType = DocumentApp.ElementType.PARAGRAPH;
var searchHeading = DocumentApp.ParagraphHeading.HEADING1;
var searchResult = null;

// Search until the paragraph is found.
while (searchResult = body.findElement(searchType, searchResult)) {
  var par = searchResult.getElement().asParagraph();
  if (par.getHeading() == searchHeading) {
    // Found one, update and stop.
    par.setText('This is the first header.');
    return;
  }
}

पैरामीटर में

नामTypeजानकारी
elementTypeElementTypeखोजने के लिए एलीमेंट का प्रकार
fromRangeElementखोज के नतीजे पाने के लिए

वापसी की ट्रेन

RangeElement — खोज का नतीजा, जो खोज एलिमेंट की अगली पोज़िशन को दिखाता है

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

findText(searchPattern)

रेगुलर एक्सप्रेशन का इस्तेमाल करके, बताए गए टेक्स्ट पैटर्न के लिए एलिमेंट के कॉन्टेंट की खोज करता है.

JavaScript के रेगुलर एक्सप्रेशन की कुछ सुविधाओं के साथ यह सुविधा काम नहीं करती, जैसे कि कैप्चर ग्रुप और मोड मॉडिफ़ायर.

दिए गए रेगुलर एक्सप्रेशन पैटर्न का मौजूदा एलिमेंट में मौजूद हर टेक्स्ट ब्लॉक से अलग मिलान किया जाता है.

पैरामीटर में

नामTypeजानकारी
searchPatternStringखोजने का पैटर्न

वापसी की ट्रेन

RangeElement — खोज के नतीजे में टेक्स्ट की जगह दिखाने वाला खोज नतीजा या मेल न खाने पर कोई नतीजा नहीं मिलता है

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

findText(searchPattern, from)

दिए गए खोज के नतीजे से शुरू करके, बताए गए टेक्स्ट पैटर्न के लिए एलिमेंट के कॉन्टेंट की खोज करता है.

JavaScript के रेगुलर एक्सप्रेशन की कुछ सुविधाओं के साथ यह सुविधा काम नहीं करती, जैसे कि कैप्चर ग्रुप और मोड मॉडिफ़ायर.

दिए गए रेगुलर एक्सप्रेशन पैटर्न का मौजूदा एलिमेंट में मौजूद हर टेक्स्ट ब्लॉक से अलग मिलान किया जाता है.

पैरामीटर में

नामTypeजानकारी
searchPatternStringखोजने का पैटर्न
fromRangeElementखोज के नतीजे पाने के लिए

वापसी की ट्रेन

RangeElement — खोज का नतीजा, जो खोज के टेक्स्ट की अगली पोज़िशन को दिखाता है या मेल नहीं खाने पर शून्य दिखाता है

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getAlignment()

HorizontalAlignment को वापस लाता है.

// Opens the Docs file by its ID. If you created your script from within
// a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('abc123456');

// Gets the document body.
const body = doc.getBody();

// Gets the first paragraph from the body.
const paragraph = body.getParagraphs()[0];

// Sets the horizontal alignment to left for the first paragraph.
paragraph.setAlignment(DocumentApp.HorizontalAlignment.LEFT);

// Gets the horizontal alignment of the first paragraph and logs it to the console.
console.log(paragraph.getAlignment().toString());

वापसी की ट्रेन

HorizontalAlignment — अलाइनमेंट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • 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 — एलिमेंट के एट्रिब्यूट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getChild(childIndex)

तय किए गए चाइल्ड इंडेक्स से चाइल्ड एलिमेंट दिखाता है.

// Get the body section of the active document.
var body = DocumentApp.getActiveDocument().getBody();

// Obtain the first element in the document.
var 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.");
}

पैरामीटर में

नामTypeजानकारी
childIndexIntegerचाइल्ड एलिमेंट का इंडेक्स, जिसे

वापसी की ट्रेन

Element — दिए गए इंडेक्स पर चाइल्ड एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getChildIndex(child)

तय किए गए चाइल्ड एलिमेंट के लिए, चाइल्ड इंडेक्स को फिर से दिखाता है.

पैरामीटर में

नामTypeजानकारी
childElementवह चाइल्ड एलिमेंट जिसके लिए इंडेक्स फिर से चाहिए

वापसी की ट्रेन

Integer — चाइल्ड इंडेक्स

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getHeading()

ParagraphHeading को वापस लाता है.

// Opens the Docs file by its ID. If you created your script from within
// a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('abc123456');

// Gets the document body.
const body = doc.getBody();

// Adds a paragraph to the body.
const paragraph = body.appendParagraph('Title heading');

// Sets the paragraph heading style to 'Title.'
paragraph.setHeading(DocumentApp.ParagraphHeading.TITLE);

// Gets the heading style and logs it to the console.
console.log(paragraph.getHeading().toString());

वापसी की ट्रेन

ParagraphHeading — शीर्षक.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getIndentEnd()

यह, इंडेंटेशन को पॉइंट में वापस लाता है.

वापसी की ट्रेन

Number — एंड इंडेंटेशन, पॉइंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getIndentFirstLine()

पॉइंट में, पहली लाइन इंडेंट हासिल करता है.

वापसी की ट्रेन

Number — पॉइंट में पहली लाइन इंडेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getIndentStart()

प्रारंभ इंडेंट फिर से मिलता है.

वापसी की ट्रेन

Number – शुरू का इंडेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getLineSpacing()

पंक्ति के बीच की दूरी को फिर से पॉइंट में लाता है.

वापसी की ट्रेन

Number — लाइन के बीच की दूरी, पॉइंट में

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • 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

getNextSibling()

एलिमेंट के अगले सिबलिंग एलिमेंट को वापस लाता है.

अगले भाई-बहन के पास वही पैरंट है जो मौजूदा एलिमेंट को फ़ॉलो करता है.

वापसी की ट्रेन

Element — अगला सिबलिंग एलिमेंट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getNumChildren()

बच्चों की संख्या दिखाता है.

// Get the body section of the active document.
var body = DocumentApp.getActiveDocument().getBody();

// Log the number of elements in the document.
Logger.log("There are " + body.getNumChildren() +
    " elements in the document body.");

वापसी की ट्रेन

Integer — बच्चों की संख्या

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getParent()

एलिमेंट के पैरंट एलिमेंट को वापस लाता है.

पैरंट एलिमेंट में मौजूदा एलिमेंट शामिल है.

वापसी की ट्रेन

ContainerElement — पैरंट एलिमेंट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getPositionedImage(id)

इमेज के आईडी का इस्तेमाल करके, PositionedImage पाएं.

पैरामीटर में

नामTypeजानकारी
idStringइमेज आईडी

वापसी की ट्रेन

PositionedImage — पोज़िशनिंग इमेज

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getPositionedImages()

पैराग्राफ़ में ऐंकर किए गए सभी PositionedImage ऑब्जेक्ट दिखाता है.

वापसी की ट्रेन

PositionedImage[] — पोज़िशन की गई इमेज की सूची

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • 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

getSpacingAfter()

एलिमेंट के बाद, पॉइंट में स्पेसिंग को फिर से सेट करता है.

वापसी की ट्रेन

Number — एलिमेंट के बाद, स्पेस में स्पेसिंग

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getSpacingBefore()

एलिमेंट से पहले, पॉइंट में स्पेसिंग को फिर से सेट करता है.

वापसी की ट्रेन

Number — एलिमेंट के बीच की दूरी, पॉइंट में

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • 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()

टेक्स्ट अलाइनमेंट हासिल करता है. अलाइनमेंट के लिए DocumentApp.TextAlignment.NORMAL, DocumentApp.TextAlignment.SUBSCRIPT, और DocumentApp.TextAlignment.SUPERSCRIPT उपलब्ध हैं.

वापसी की ट्रेन

TextAlignment — टेक्स्ट अलाइनमेंट का टाइप या null अगर टेक्स्ट में कई तरह के टेक्स्ट अलाइनमेंट हैं या टेक्स्ट अलाइनमेंट कभी सेट नहीं हुआ है

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • 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 — एलिमेंट का टाइप.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

insertHorizontalRule(childIndex)

तय इंडेक्स में HorizontalRule बनाता और शामिल करता है.

पैरामीटर में

नामTypeजानकारी
childIndexIntegerवह इंडेक्स जिसमें एलिमेंट शामिल करना है

वापसी की ट्रेन

HorizontalRule — हॉरिज़ॉन्टल रूल वाला नया एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

insertInlineImage(childIndex, image)

तय इंडेक्स में, तय किए गए इमेज BLOB से एक नया InlineImage बनाता और शामिल करता है.

पैरामीटर में

नामTypeजानकारी
childIndexIntegerवह इंडेक्स जिसमें एलिमेंट शामिल करना है
imageBlobSourceइमेज डेटा

वापसी की ट्रेन

InlineImage — इनलाइन इमेज एलिमेंट शामिल किया गया

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

insertInlineImage(childIndex, image)

बताए गए इंडेक्स में दिया गया InlineImage डालता है.

पैरामीटर में

नामTypeजानकारी
childIndexIntegerवह इंडेक्स जिसमें एलिमेंट शामिल करना है
imageInlineImageइमेज डेटा

वापसी की ट्रेन

InlineImage — इनलाइन इमेज एलिमेंट शामिल किया गया

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

insertPageBreak(childIndex)

तय इंडेक्स में नया PageBreak बनाता और शामिल करता है.

ध्यान दें: हो सकता है कि PageBreaks को TableCells में शामिल न किया गया हो. अगर टेबल एलिमेंट में मौजूदा एलिमेंट शामिल है, तो अपवाद माना जाएगा.

पैरामीटर में

नामTypeजानकारी
childIndexIntegerवह इंडेक्स जिसमें एलिमेंट शामिल करना है

वापसी की ट्रेन

PageBreak — नया पेज ब्रेक एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

insertPageBreak(childIndex, pageBreak)

बताए गए इंडेक्स में दिया गया PageBreak डालता है.

ध्यान दें: हो सकता है कि PageBreaks को TableCells में शामिल न किया गया हो. अगर टेबल एलिमेंट में मौजूदा एलिमेंट शामिल है, तो अपवाद माना जाएगा.

पैरामीटर में

नामTypeजानकारी
childIndexIntegerवह इंडेक्स जिसमें एलिमेंट शामिल करना है
pageBreakPageBreakपेज पर जाने के लिए [कम समय]

वापसी की ट्रेन

PageBreak — डाला गया पेज ब्रेक एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

insertText(childIndex, text)

तय किए गए इंडेक्स में नया टेक्स्ट एलिमेंट बनाता है और उसे शामिल करता है.

पैरामीटर में

नामTypeजानकारी
childIndexIntegerवह इंडेक्स जिसमें एलिमेंट शामिल करना है
textStringटेक्स्ट का कॉन्टेंट

वापसी की ट्रेन

Text — नया टेक्स्ट एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

insertText(childIndex, text)

बताए गए इंडेक्स पर, दिया गया Text एलिमेंट शामिल करता है.

पैरामीटर में

नामTypeजानकारी
childIndexIntegerवह इंडेक्स जिसमें एलिमेंट शामिल करना है
textTextशामिल करने के लिए टेक्स्ट एलिमेंट

वापसी की ट्रेन

Text — डाला गया टेक्स्ट एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • 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

isLeftToRight()

बाईं-से-दाईं सेटिंग को फिर से हासिल करता है.

वापसी की ट्रेन

Boolean — बाएं से दाएं सेटिंग

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

merge()

एलिमेंट को इसी तरह के पिछले सिबलिंग के साथ मर्ज करता है.

एक ही ElementType के एलिमेंट को मर्ज किया जा सकता है. मौजूदा एलिमेंट में मौजूद चाइल्ड एलिमेंट, पिछले एलिमेंट में ले जाए जाते हैं.

मौजूदा एलिमेंट को दस्तावेज़ से हटा दिया जाता है.

var body = DocumentApp.getActiveDocument().getBody();
// Example 1: Merge paragraphs
// Append two paragraphs to the document.
var par1 = body.appendParagraph('Paragraph 1.');
var 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.
var cells = [
['Row 1, Cell 1', 'Row 1, Cell 2'],
['Row 2, Cell 1', 'Row 2, Cell 2']
];
// Build a table from the array.
var table = body.appendTable(cells);
// Get the first row in the table.
 var row = table.getRow(0);
// Get the two cells in this row.
var cell1 = row.getCell(0);
var cell2 = row.getCell(1);
// Merge the current cell into its preceding sibling element.
var merged = cell2.merge();

वापसी की ट्रेन

Paragraph — मर्ज किया गया एलिमेंट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

removeChild(child)

बताए गए चाइल्ड एलिमेंट को हटाता है.

पैरामीटर में

नामTypeजानकारी
childElementहटाया जाने वाला चाइल्ड एलिमेंट

वापसी की ट्रेन

Paragraph — मौजूदा एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

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();
}

वापसी की ट्रेन

Paragraph — हटाया गया एलिमेंट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

removePositionedImage(id)

इमेज के आईडी के ज़रिए PositionedImage हटा देता है.

पैरामीटर में

नामTypeजानकारी
idStringइमेज आईडी

वापसी की ट्रेन

Boolean — बताई गई इमेज को हटाया गया या नहीं

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

replaceText(searchPattern, replacement)

रेगुलर एक्सप्रेशन का इस्तेमाल करके, किसी दिए गए टेक्स्ट पैटर्न की सभी घटनाओं को किसी बदली गई स्ट्रिंग से बदलता है.

खोज के पैटर्न को एक स्ट्रिंग के तौर पर पास किया जाता है, न कि JavaScript रेगुलर एक्सप्रेशन ऑब्जेक्ट के तौर पर. इस वजह से, आपको पैटर्न में मौजूद बैकस्लैश छोड़ने होंगे.

ये तरीके, Google की RE2 रेगुलर एक्सप्रेशन लाइब्रेरी का इस्तेमाल करते हैं, जो काम करने वाले सिंटैक्स को सीमित कर देती है.

दिए गए रेगुलर एक्सप्रेशन पैटर्न का मौजूदा एलिमेंट में मौजूद हर टेक्स्ट ब्लॉक से अलग मिलान किया जाता है.

var body = DocumentApp.getActiveDocument().getBody();

// Clear the text surrounding "Apps Script", with or without text.
body.replaceText("^.*Apps ?Script.*$", "Apps Script");

पैरामीटर में

नामTypeजानकारी
searchPatternStringखोजने के लिए, रेगुलर एक्सप्रेशन पैटर्न
replacementStringबदलने के लिए इस्तेमाल किया जाने वाला टेक्स्ट

वापसी की ट्रेन

Element — मौजूदा एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setAlignment(alignment)

HorizontalAlignment सेट करें.

पैरामीटर में

नामTypeजानकारी
alignmentHorizontalAlignmentहॉरिज़ॉन्टल अलाइनमेंट

वापसी की ट्रेन

Paragraph — मौजूदा एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • 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);

पैरामीटर में

नामTypeजानकारी
attributesObjectएलिमेंट के एट्रिब्यूट.

वापसी की ट्रेन

Paragraph — मौजूदा एलिमेंट.

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setHeading(heading)

ParagraphHeading सेट करें.

पैरामीटर में

नामTypeजानकारी
headingParagraphHeadingहेडिंग

वापसी की ट्रेन

Paragraph — मौजूदा एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setIndentEnd(indentEnd)

एंड इंडेंटेशन को पॉइंट में सेट करता है.

पैरामीटर में

नामTypeजानकारी
indentEndNumberअंतिम इंडेंटेशन,

वापसी की ट्रेन

Paragraph — मौजूदा एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setIndentFirstLine(indentFirstLine)

पॉइंट में पहला लाइन इंडेंट सेट करता है.

पैरामीटर में

नामTypeजानकारी
indentFirstLineNumberप्रथम पंक्ति इंडेंटेशन, बिंदु में

वापसी की ट्रेन

Paragraph — मौजूदा एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setIndentStart(indentStart)

शुरुआत का इंडेंट, पॉइंट में सेट करता है.

पैरामीटर में

नामTypeजानकारी
indentStartNumberशुरुआती इंडेंट

वापसी की ट्रेन

Paragraph — मौजूदा एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setLeftToRight(leftToRight)

बाएं-से-दाएं सेटिंग सेट करता है.

पैरामीटर में

नामTypeजानकारी
leftToRightBooleanबाईं से दाईं ओर की सेटिंग

वापसी की ट्रेन

Paragraph — मौजूदा एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setLineSpacing(multiplier)

लाइनों के बीच की दूरी को तय करने वाली संख्या के तौर पर लाइन स्पेसिंग सेट करता है.

पैरामीटर में

नामTypeजानकारी
multiplierNumberलाइनों की संख्या

वापसी की ट्रेन

Paragraph — मौजूदा एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setLinkUrl(url)

लिंक यूआरएल सेट करता है.

पैरामीटर में

नामTypeजानकारी
urlStringलिंक यूआरएल

वापसी की ट्रेन

Paragraph — मौजूदा एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setSpacingAfter(spacingAfter)

एलिमेंट के बाद, पॉइंट में स्पेसिंग सेट करता है.

पैरामीटर में

नामTypeजानकारी
spacingAfterNumberएलिमेंट के बाद स्पेस में, पॉइंट पर

वापसी की ट्रेन

Paragraph — मौजूदा एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setSpacingBefore(spacingBefore)

एलिमेंट से पहले, पॉइंट में स्पेसिंग सेट करता है.

पैरामीटर में

नामTypeजानकारी
spacingBeforeNumberएलिमेंट से पहले, स्पेस में,

वापसी की ट्रेन

Paragraph — मौजूदा एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setText(text)

पैराग्राफ़ की सामग्री को लेख के रूप में सेट करता है.

ध्यान दें: मौजूदा कॉन्टेंट मिटा दिए गए हैं.

पैरामीटर में

नामTypeजानकारी
textStringटेक्स्ट का नया कॉन्टेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setTextAlignment(textAlignment)

टेक्स्ट अलाइनमेंट सेट करता है. अलाइनमेंट के लिए DocumentApp.TextAlignment.NORMAL, DocumentApp.TextAlignment.SUBSCRIPT, और DocumentApp.TextAlignment.SUPERSCRIPT उपलब्ध हैं.

// Make the entire first paragraph be superscript.
var text = DocumentApp.getActiveDocument().getBody().getParagraphs()[0].editAsText();
text.setTextAlignment(DocumentApp.TextAlignment.SUPERSCRIPT);

पैरामीटर में

नामTypeजानकारी
textAlignmentTextAlignmentजिस तरह का टेक्स्ट अलाइनमेंट लागू करना है

वापसी की ट्रेन

Paragraph — मौजूदा एलिमेंट

अनुमति देना

इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या ज़्यादा दायरे की अनुमति होनी चाहिए:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents