Class InlineImage

InlineImage

एम्बेड की गई इमेज को दिखाने वाला एलिमेंट. InlineImage को ListItem या Paragraph में शामिल किया जा सकता है. हालांकि, अगर ListItem या Paragraph, FootnoteSection में शामिल है, तो ऐसा नहीं किया जा सकता. InlineImage में कोई दूसरा एलिमेंट शामिल नहीं किया जा सकता. दस्तावेज़ के स्ट्रक्चर के बारे में ज़्यादा जानने के लिए, Google Docs को एक्सटेंड करने से जुड़ी गाइड देखें.

तरीके

तरीकारिटर्न टाइपसंक्षिप्त विवरण
copy()InlineImageयह फ़ंक्शन, मौजूदा एलिमेंट की अलग की गई डीप कॉपी दिखाता है.
getAltDescription()String|nullयह इमेज के बारे में वैकल्पिक जानकारी दिखाता है.
getAltTitle()String|nullयह इमेज का वैकल्पिक टाइटल दिखाता है.
getAs(contentType)Blobइस ऑब्जेक्ट में मौजूद डेटा को, बताए गए कॉन्टेंट टाइप में बदले गए ब्लॉब के तौर पर दिखाता है.
getAttributes()Objectयह एलिमेंट के एट्रिब्यूट वापस लाता है.
getBlob()Blobइस ऑब्जेक्ट में मौजूद डेटा को blob के तौर पर दिखाओ.
getHeight()Integerइस फ़ंक्शन से, इमेज की ऊंचाई पिक्सेल में मिलती है.
getLinkUrl()String|nullयह कुकी, लिंक किए गए यूआरएल को फिर से पाने में मदद करती है.
getNextSibling()Element|nullयह एलिमेंट के अगले सिबलिंग एलिमेंट को वापस लाता है.
getParent()ContainerElement|nullयह एलिमेंट के पैरंट एलिमेंट को वापस लाता है.
getPreviousSibling()Element|nullयह एलिमेंट के पिछले सिबलिंग एलिमेंट को वापस लाता है.
getType()ElementTypeयह एलिमेंट के ElementType को वापस लाता है.
getWidth()Integerयह फ़ंक्शन, इमेज की चौड़ाई को पिक्सल में दिखाता है.
isAtDocumentEnd()Booleanइससे यह तय होता है कि एलिमेंट, Document के आखिर में है या नहीं.
merge()InlineImage|nullइस विकल्प का इस्तेमाल करके, एलिमेंट को उसी तरह के पिछले एलिमेंट के साथ मर्ज किया जाता है.
removeFromParent()InlineImage|nullइस तरीके का इस्तेमाल करके, एलिमेंट को उसके पैरंट से हटाया जा सकता है.
setAltDescription(description)InlineImageइससे इमेज के लिए वैकल्पिक जानकारी सेट की जाती है.
setAltTitle(title)InlineImageइससे इमेज का वैकल्पिक टाइटल सेट होता है.
setAttributes(attributes)InlineImageयह एलिमेंट के एट्रिब्यूट सेट करता है.
setHeight(height)InlineImageइस विकल्प का इस्तेमाल करके, इमेज की ऊंचाई को पिक्सल में सेट किया जाता है.
setLinkUrl(url)InlineImageयह कुकी, लिंक किए गए यूआरएल को सेट करती है.
setWidth(width)InlineImageइससे इमेज की चौड़ाई पिक्सल में सेट होती है.

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

copy()

यह फ़ंक्शन, मौजूदा एलिमेंट की अलग की गई डीप कॉपी दिखाता है.

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

वापसी का टिकट

InlineImage — नई कॉपी.

अनुमति देना

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

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

getAltDescription()

यह इमेज के बारे में वैकल्पिक जानकारी दिखाता है.

वापसी का टिकट

String|null — वैकल्पिक ब्यौरा या null, अगर एलिमेंट का कोई वैकल्पिक ब्यौरा नहीं है.

अनुमति देना

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

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

getAltTitle()

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

वापसी का टिकट

String|null — वैकल्पिक टाइटल या null, अगर एलिमेंट का कोई वैकल्पिक टाइटल नहीं है.

अनुमति देना

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

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

getAs(contentType)

इस ऑब्जेक्ट में मौजूद डेटा को, बताए गए कॉन्टेंट टाइप में बदले गए ब्लॉब के तौर पर दिखाता है. इस तरीके से, फ़ाइल के नाम में सही एक्सटेंशन जुड़ जाता है. उदाहरण के लिए, "myfile.pdf". हालांकि, यह मानता है कि फ़ाइल नाम का वह हिस्सा जो आखिरी अवधि के बाद आता है (अगर कोई हो), एक मौजूदा एक्सटेंशन है जिसे बदला जाना चाहिए. इसलिए, "ShoppingList.12.25.2014" बदलकर "ShoppingList.12.25.pdf" हो जाता है.

कन्वर्ज़न के लिए रोज़ाना के कोटा देखने के लिए, Google की सेवाओं के लिए कोटा देखें. नए Google Workspace डोमेन पर, कुछ समय के लिए ज़्यादा पाबंदियां लागू हो सकती हैं.

पैरामीटर

नामटाइपब्यौरा
contentTypeStringजिस MIME टाइप में बदलना है. ज़्यादातर ब्लॉब के लिए, 'application/pdf' ही मान्य विकल्प है. BMP, GIF, JPEG या PNG फ़ॉर्मैट में मौजूद इमेज के लिए, 'image/bmp', 'image/gif', 'image/jpeg' या 'image/png' में से कोई भी मान्य है. Google Docs दस्तावेज़ के लिए, 'text/markdown' भी मान्य है.

वापसी का टिकट

Blob — डेटा को एक बड़े बाइनरी ऑब्जेक्ट के तौर पर दिखाया जाता है.


getAttributes()

यह एलिमेंट के एट्रिब्यूट वापस लाता है.

नतीजा एक ऐसा ऑब्जेक्ट होता है जिसमें हर मान्य एलिमेंट एट्रिब्यूट के लिए एक प्रॉपर्टी होती है. इसमें हर प्रॉपर्टी का नाम, DocumentApp.Attribute इन्यूमरेशन में मौजूद किसी आइटम से मेल खाता है.

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

getBlob()

इस ऑब्जेक्ट में मौजूद डेटा को blob के तौर पर दिखाओ.

वापसी का टिकट

Blob — डेटा को एक बड़े बाइनरी ऑब्जेक्ट के तौर पर दिखाया जाता है.


getHeight()

इस तरीके से, इमेज की ऊंचाई पिक्सेल में मिलती है.

वापसी का टिकट

Integer — पिक्सल में इमेज की ऊंचाई

अनुमति देना

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

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

getLinkUrl()

यह कुकी, लिंक किए गए यूआरएल को वापस पाती है.

वापसी का टिकट

String|null — लिंक का यूआरएल या null, अगर एलिमेंट में इस एट्रिब्यूट के लिए एक से ज़्यादा वैल्यू मौजूद हैं.

अनुमति देना

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

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

getNextSibling()

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

अगले सिबलिंग का पैरंट वही होता है जो मौजूदा एलिमेंट का होता है. साथ ही, यह मौजूदा एलिमेंट के बाद आता है.

वापसी का टिकट

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

अनुमति देना

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

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

getParent()

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

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

वापसी का टिकट

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

अनुमति देना

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

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

getPreviousSibling()

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

पिछला सिबलिंग, मौजूदा एलिमेंट से पहले आता है और उसका पैरंट एलिमेंट भी मौजूदा एलिमेंट जैसा ही होता है.

वापसी का टिकट

Element|null — पिछला सिबलिंग एलिमेंट.

अनुमति देना

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

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

getType()

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

किसी एलिमेंट के टाइप का पता लगाने के लिए, getType() का इस्तेमाल करें.

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.');
}

वापसी का टिकट

ElementType — एलिमेंट का टाइप.

अनुमति देना

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

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

getWidth()

यह फ़ंक्शन, इमेज की चौड़ाई को पिक्सल में दिखाता है.

वापसी का टिकट

Integer — इमेज की चौड़ाई, पिक्सल में

अनुमति देना

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

  • 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 के एलिमेंट मर्ज किए जा सकते हैं. मौजूदा एलिमेंट में मौजूद सभी चाइल्ड एलिमेंट को, पहले वाले सिबलिंग एलिमेंट में ले जाया जाता है.

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

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

वापसी का टिकट

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

अनुमति देना

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

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

वापसी का टिकट

InlineImage|null — हटाया गया एलिमेंट.

अनुमति देना

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

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

setAltDescription(description)

इससे इमेज के लिए वैकल्पिक जानकारी सेट की जाती है. अगर दिया गया ब्यौरा null है, तो ब्यौरे को खाली स्ट्रिंग पर सेट करता है.

पैरामीटर

नामटाइपब्यौरा
descriptionStringवैकल्पिक जानकारी.

वापसी का टिकट

InlineImage — मौजूदा ऑब्जेक्ट.

अनुमति देना

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

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

setAltTitle(title)

इससे इमेज का वैकल्पिक टाइटल सेट होता है. अगर दिया गया टाइटल null है, तो टाइटल को खाली स्ट्रिंग पर सेट करता है.

पैरामीटर

नामटाइपब्यौरा
titleStringवैकल्पिक टाइटल.

वापसी का टिकट

InlineImage — मौजूदा ऑब्जेक्ट.

अनुमति देना

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

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

setAttributes(attributes)

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

तय किया गया एट्रिब्यूट पैरामीटर एक ऑब्जेक्ट होना चाहिए. इसमें हर प्रॉपर्टी का नाम, DocumentApp.Attribute इन्यूमरेशन में मौजूद एक आइटम होता है. साथ ही, हर प्रॉपर्टी की वैल्यू, लागू की जाने वाली नई वैल्यू होती है.

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

पैरामीटर

नामटाइपब्यौरा
attributesObjectएलिमेंट के एट्रिब्यूट.

वापसी का टिकट

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

अनुमति देना

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

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

setHeight(height)

इस विकल्प का इस्तेमाल करके, इमेज की ऊंचाई को पिक्सल में सेट किया जाता है.

पैरामीटर

नामटाइपब्यौरा
heightIntegerइमेज की ऊंचाई, पिक्सल में

वापसी का टिकट

InlineImage — मौजूदा ऑब्जेक्ट

अनुमति देना

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

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

setLinkUrl(url)

यह कुकी, लिंक किए गए यूआरएल को सेट करती है. अगर दिया गया यूआरएल null या खाली स्ट्रिंग है, तो यह तरीका एक ऐसा लिंक बनाता है जिसका यूआरएल खाली होता है. यह Google Docs में "अमान्य लिंक" के तौर पर दिख सकता है.

पैरामीटर

नामटाइपब्यौरा
urlStringलिंक का यूआरएल.

वापसी का टिकट

InlineImage — मौजूदा ऑब्जेक्ट.

अनुमति देना

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

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

setWidth(width)

इससे इमेज की चौड़ाई पिक्सल में सेट होती है.

पैरामीटर

नामटाइपब्यौरा
widthIntegerइमेज की चौड़ाई, पिक्सल में

वापसी का टिकट

InlineImage — मौजूदा ऑब्जेक्ट

अनुमति देना

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

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