Class Person

Person

किसी व्यक्ति के लिंक को दिखाने वाला एलिमेंट. 'व्यक्ति' लिंक, ईमेल पते को बताता है और हो सकता है कि इस पते से कोई नाम जुड़ा हो. अगर यह नाम सेट किया जाता है, तो दस्तावेज़ के मुख्य हिस्से में यही नाम दिखता है.

तरीके

तरीकारिटर्न टाइपसंक्षिप्त विवरण
copy()Personमौजूदा एलिमेंट की डिटैच की गई और डीप कॉपी दिखाता है.
getAttributes()Objectएलिमेंट के एट्रिब्यूट वापस लाता है.
getEmail()Stringव्यक्ति का ईमेल पता दिखाता है.
getName()Stringसेट किए जाने पर व्यक्ति का डिसप्ले नेम दिखाता है.
getNextSibling()Elementएलिमेंट का अगला सिबलिंग एलिमेंट वापस लाता है.
getParent()ContainerElementएलिमेंट के पैरंट एलिमेंट को वापस लाता है.
getPreviousSibling()Elementएलिमेंट के पिछले सिबलिंग एलिमेंट को फिर से लाता है.
getType()ElementTypeएलिमेंट के ElementType को फिर से लाता है.
isAtDocumentEnd()Booleanइससे पता चलता है कि एलिमेंट, Document के आखिर में है या नहीं.
merge()Personएलिमेंट को उसी तरह के पिछले सिबलिंग के साथ मर्ज करता है.
removeFromParent()Personइसके पैरंट से एलिमेंट हटा देता है.
setAttributes(attributes)Personएलिमेंट के एट्रिब्यूट सेट करता है.

ज़्यादा जानकारी के साथ दस्तावेज़

copy()

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

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

रिटर्न

Person — नई कॉपी.

अनुमति देना

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

  • 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

getEmail()

व्यक्ति का ईमेल पता दिखाता है.

रिटर्न

String — व्यक्ति का ईमेल पता.

अनुमति देना

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

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

getName()

सेट किए जाने पर व्यक्ति का डिसप्ले नेम दिखाता है.

रिटर्न

String — व्यक्ति के लिंक का डिसप्ले नेम. इसके अलावा, अगर एलिमेंट में ईमेल पता मौजूद है, तो null.

अनुमति देना

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

  • 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

getParent()

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

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

रिटर्न

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

अनुमति देना

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

  • 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

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

isAtDocumentEnd()

इससे पता चलता है कि एलिमेंट, Document के आखिर में है या नहीं.

रिटर्न

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

रिटर्न

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

अनुमति देना

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

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

रिटर्न

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

अनुमति देना

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

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

रिटर्न

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

अनुमति देना

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

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