Class Paragraph

Paragraf

Paragrafı temsil eden bir öğe. Bir Paragraph şunları içerebilir: Equation, Footnote, HorizontalRule, InlineDrawing, InlineImage, PageBreak, ve Text öğeleri. Doküman yapısı hakkında daha fazla bilgi edinmek için Google Dokümanlar'ı genişletme kılavuzuna göz atın.

Paragraphs, yeni satır karakterleri içeremez. Yeni satır karakterleri ("\n") satır sonu karakterlerine ("\t") dönüştürülür.

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

// Append a tab 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.");

Yöntemler

YöntemDönüş türüKısa açıklama
addPositionedImage(image)PositionedImageBelirtilen görüntü blobundan yeni bir PositionedImage oluşturur ve ekler.
appendHorizontalRule()HorizontalRuleYeni bir HorizontalRule oluşturur ve ekler.
appendInlineImage(image)InlineImageBelirtilen görüntü blobundan yeni bir InlineImage oluşturur ve ekler.
appendInlineImage(image)InlineImageBelirtilen InlineImage öğesini ekler.
appendPageBreak()PageBreakYeni bir PageBreak oluşturur ve ekler.
appendPageBreak(pageBreak)PageBreakBelirtilen PageBreak öğesini ekler.
appendText(text)TextBelirtilen içeriğe sahip yeni bir Text öğesi oluşturur ve ekler.
appendText(text)TextBelirtilen Text öğesini ekler.
clear()ParagraphÖğenin içeriğini temizler.
copy()ParagraphGeçerli öğenin ayrılmış, derin bir kopyasını döndürür.
editAsText()TextDüzenleme için geçerli öğenin Text sürümünü alır.
findElement(elementType)RangeElementÖğenin içeriğinde, belirtilen türün bir alt öğesini arar.
findElement(elementType, from)RangeElementÖğenin içeriğinde, belirtilen RangeElement.
findText(searchPattern)RangeElementNormal ifadeler kullanarak belirtilen metin kalıbı için öğenin içeriğinde arama yapar.
findText(searchPattern, from)RangeElementBelirli bir değerden başlayarak belirtilen metin kalıbı için öğenin içeriğinde arama yapar emin olun.
getAlignment()HorizontalAlignmentHorizontalAlignment öğesini alır.
getAttributes()ObjectÖğenin özelliklerini alır.
getChild(childIndex)ElementBelirtilen alt dizindeki alt öğeyi alır.
getChildIndex(child)IntegerBelirtilen alt öğe için alt dizini alır.
getHeading()ParagraphHeadingParagraphHeading öğesini alır.
getIndentEnd()NumberNokta olarak son girintiyi alır.
getIndentFirstLine()NumberNokta cinsinden ilk satır girintisini alır.
getIndentStart()NumberBaşlangıç girintisini alır.
getLineSpacing()NumberNokta cinsinden satır aralığını alır.
getLinkUrl()StringBağlantı URL'sini alır.
getNextSibling()ElementÖğenin sonraki eşdüzey öğeyi alır.
getNumChildren()IntegerAlt öğelerin sayısını alır.
getParent()ContainerElementÖğenin üst öğesini alır.
getPositionedImage(id)PositionedImageResmin kimliğine göre bir PositionedImage alır.
getPositionedImages()PositionedImage[]PositionedImage nesnenin tümünü paragrafa sabitler.
getPreviousSibling()ElementÖğenin önceki eşdüzey öğesini alır.
getSpacingAfter()NumberÖğeden sonraki boşluğu, nokta cinsinden alır.
getSpacingBefore()NumberNokta cinsinden öğeden önceki boşluğu alır.
getText()StringÖğenin içeriğini bir metin dizesi olarak alır.
getTextAlignment()TextAlignmentMetin hizalamasını getirir.
getType()ElementTypeÖğenin ElementType değerini alır.
insertHorizontalRule(childIndex)HorizontalRuleHorizontalRule oluşturur ve belirtilen dizine ekler.
insertInlineImage(childIndex, image)InlineImageBelirtilen konumda, belirtilen görüntü blobundan yeni bir InlineImage oluşturur ve ekler dizin.
insertInlineImage(childIndex, image)InlineImageVerilen InlineImage öğesini belirtilen dizine ekler.
insertPageBreak(childIndex)PageBreakYeni bir PageBreak oluşturur ve belirtilen dizine ekler.
insertPageBreak(childIndex, pageBreak)PageBreakVerilen PageBreak öğesini belirtilen dizine ekler.
insertText(childIndex, text)TextYeni bir metin öğesi oluşturur ve belirtilen dizine ekler.
insertText(childIndex, text)TextBelirtilen dizine belirtilen Text öğesini, belirtilen metinle ekler içerik.
isAtDocumentEnd()BooleanÖğenin, Document öğesinin sonunda olup olmadığını belirler.
isLeftToRight()BooleanSoldan sağa ayarı alır.
merge()ParagraphÖğeyi, aynı türden bir önceki kardeş öğeyle birleştirir.
removeChild(child)ParagraphBelirtilen alt öğeyi kaldırır.
removeFromParent()ParagraphÖğeyi üst öğesinden kaldırır.
removePositionedImage(id)BooleanResmin kimliğine göre bir PositionedImage kaldırılır.
replaceText(searchPattern, replacement)ElementBelirli bir metin kalıbının tüm tekrarlarını, normal değer kullanarak belirli bir değiştirme dizesiyle değiştirir ifade eder.
setAlignment(alignment)ParagraphHorizontalAlignment özelliğini ayarlar.
setAttributes(attributes)ParagraphÖğenin özelliklerini ayarlar.
setHeading(heading)ParagraphParagraphHeading özelliğini ayarlar.
setIndentEnd(indentEnd)ParagraphBitiş girintisini punto olarak ayarlar.
setIndentFirstLine(indentFirstLine)Paragraphİlk satır girintisini punto olarak ayarlar.
setIndentStart(indentStart)ParagraphBaşlangıç girintisini punto olarak ayarlar.
setLeftToRight(leftToRight)ParagraphSoldan sağa ayarını belirler.
setLineSpacing(multiplier)ParagraphSatır aralığını, boşluk için kullanılacak satır sayısını gösteren bir miktar olarak ayarlar.
setLinkUrl(url)ParagraphBağlantı URL'sini ayarlar.
setSpacingAfter(spacingAfter)ParagraphÖğeden sonraki boşluğu punto cinsinden ayarlar.
setSpacingBefore(spacingBefore)ParagraphÖğeden önceki boşluğu punto cinsinden ayarlar.
setText(text)voidParagrafın içeriğini metin olarak ayarlar.
setTextAlignment(textAlignment)ParagraphMetin hizalamasını ayarlar.

Ayrıntılı belgeler

addPositionedImage(image)

Belirtilen görüntü blobundan yeni bir PositionedImage oluşturur ve ekler.

// 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 body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('t.0').asDocumentTab().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 tab, anchored to the first paragraph.
paragraph.addPositionedImage(image);

Parametreler

AdTürAçıklama
imageBlobSourceResim verileri.

Return

PositionedImage — Yeni konumlandırılmış resim.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

appendHorizontalRule()

Yeni bir HorizontalRule oluşturur ve ekler.

// 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 body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('t.0').asDocumentTab().getBody();

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

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

Return

HorizontalRule — Yeni yatay kural.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

appendInlineImage(image)

Belirtilen görüntü blobundan yeni bir InlineImage oluşturur ve ekler.

// 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 body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('t.0').asDocumentTab().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);

Parametreler

AdTürAçıklama
imageBlobSourceResim verileri.

Return

InlineImage — Eklenen resim.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

appendInlineImage(image)

Belirtilen InlineImage öğesini ekler.

// 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 body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('t.0').asDocumentTab().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);

Parametreler

AdTürAçıklama
imageInlineImageResim verileri.

Return

InlineImage — Eklenen resim.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

appendPageBreak()

Yeni bir PageBreak oluşturur ve ekler.

Not: PageBreaks, TableCells içinde yer alamaz. Geçerli öğe bir tablo hücresinde yer alıyorsa bir istisna oluşur.

// 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 body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('t.0').asDocumentTab().getBody();

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

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

Return

PageBreak: Yeni sayfa sonu öğesi.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

appendPageBreak(pageBreak)

Belirtilen PageBreak öğesini ekler.

Not: PageBreaks, TableCells içinde yer alamaz. Geçerli öğe bir tablo hücresinde varsa komut dosyası bir istisna uygular.

// 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 body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('t.0').asDocumentTab().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);

Parametreler

AdTürAçıklama
pageBreakPageBreakEklenecek sayfa sonu.

Return

PageBreak — Eklenen sayfa sonu öğesi.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

appendText(text)

Belirtilen içeriğe sahip yeni bir Text öğesi oluşturur ve ekler.

// 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 body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('t.0').asDocumentTab().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.');

Parametreler

AdTürAçıklama
textStringMetin içerikleri.

Return

Text: Yeni metin öğesi.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

appendText(text)

Belirtilen Text öğesini ekler.

 // 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 body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('t.0').asDocumentTab().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);

Parametreler

AdTürAçıklama
textTextEklenecek metin öğesi.

Return

Text: Eklenen metin öğesi.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

clear()

Öğenin içeriğini temizler.

Return

Paragraph: Geçerli öğe.


copy()

Geçerli öğenin ayrılmış, derin bir kopyasını döndürür.

Öğede bulunan tüm alt öğeler de kopyalanır. Yeni öğede üst öğesidir.

Return

Paragraph — Yeni kopya.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

editAsText()

Düzenleme için geçerli öğenin Text sürümünü alır.

Öğe içeriklerini zengin metin olarak değiştirmek için editAsText kullanın. editAsText modu, metin olmayan öğeleri (InlineImage ve HorizontalRule gibi) yoksayar.

Silinmiş bir metin aralığında tamamen yer alan alt öğeler öğeden kaldırılır.

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

Return

Text: Geçerli öğenin metin sürümü


findElement(elementType)

Öğenin içeriğinde, belirtilen türün bir alt öğesini arar.

Parametreler

AdTürAçıklama
elementTypeElementTypeAranacak öğenin türü.

Return

RangeElement: Arama öğesinin konumunu gösteren bir arama sonucu.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

findElement(elementType, from)

Öğenin içeriğinde, belirtilen RangeElement.

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

Parametreler

AdTürAçıklama
elementTypeElementTypeAranacak öğenin türü.
fromRangeElementArama yapılacak arama sonucu.

Return

RangeElement: Arama öğesinin sonraki konumunu gösteren arama sonucu.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

findText(searchPattern)

Normal ifadeler kullanarak belirtilen metin kalıbı için öğenin içeriğinde arama yapar.

JavaScript normal ifade özelliklerinin bir alt kümesi tam olarak desteklenmiyor; örneğin, ve mod değiştiricileri yakalayabilirsiniz.

Sağlanan normal ifade kalıbı her metin bloğuyla bağımsız olarak eşleştirilir öğedir.

Parametreler

AdTürAçıklama
searchPatternStringaranacak kalıp

Return

RangeElement — arama metninin konumunu veya konumunu gösteren bir arama sonucu yoksa null denk gelmek

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

findText(searchPattern, from)

Belirli bir değerden başlayarak belirtilen metin kalıbı için öğenin içeriğinde arama yapar emin olun.

JavaScript normal ifade özelliklerinin bir alt kümesi tam olarak desteklenmiyor; örneğin, ve mod değiştiricileri yakalayabilirsiniz.

Sağlanan normal ifade kalıbı her metin bloğuyla bağımsız olarak eşleştirilir öğedir.

Parametreler

AdTürAçıklama
searchPatternStringaranacak kalıp
fromRangeElementarama sonuçlarında

Return

RangeElement — arama metninin sonraki konumunu gösteren bir arama sonucu veya denk gelmek

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getAlignment()

HorizontalAlignment öğesini alır.

// 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 body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('t.0').asDocumentTab().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());

Return

HorizontalAlignment: Hizalama.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getAttributes()

Öğenin özelliklerini alır.

Sonuç, her bir geçerli öğe özelliği için bir özellik içeren özellik adı, DocumentApp.Attribute numaralandırmasındaki bir öğeye karşılık gelir.

var doc = DocumentApp.getActiveDocument();
var documentTab = doc.getActiveTab().asDocumentTab();
var body = documentTab.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]);
}

Return

Object: Öğenin özellikleri.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getChild(childIndex)

Belirtilen alt dizindeki alt öğeyi alır.

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

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

Parametreler

AdTürAçıklama
childIndexIntegerAlınacak alt öğenin dizini.

Return

Element: Belirtilen dizindeki alt öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getChildIndex(child)

Belirtilen alt öğe için alt dizini alır.

Parametreler

AdTürAçıklama
childElementDizinin alınacağı alt öğe.

Return

Integer — Alt dizin.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getHeading()

ParagraphHeading öğesini alır.

// 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 body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('t.0').asDocumentTab().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());

Return

ParagraphHeading: Başlık.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getIndentEnd()

Nokta olarak son girintiyi alır.

Return

Number — punto cinsinden son girinti

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getIndentFirstLine()

Nokta cinsinden ilk satır girintisini alır.

Return

Number - punto cinsinden ilk satır girintisi

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getIndentStart()

Başlangıç girintisini alır.

Return

Number — başlangıç girintisi

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getLineSpacing()

Nokta cinsinden satır aralığını alır.

Return

Number — satır aralığı, punto cinsinden

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getLinkUrl()

Bağlantı URL'sini alır.

Return

String: bağlantı URL'si veya öğe bu özellik için birden fazla değer içeriyorsa null

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getNextSibling()

Öğenin sonraki eşdüzey öğeyi alır.

Sonraki kardeş öğe, aynı üst öğeye sahiptir ve geçerli öğeyi takip eder.

Return

Element: Sonraki kardeş öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getNumChildren()

Alt öğelerin sayısını alır.

var 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.");

Return

Integer — Alt öğelerin sayısı.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getParent()

Öğenin üst öğesini alır.

Üst öğe, geçerli öğeyi içeriyor.

Return

ContainerElement: Üst öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getPositionedImage(id)

Resmin kimliğine göre bir PositionedImage alır.

Parametreler

AdTürAçıklama
idStringresim kimliği

Return

PositionedImage — konumlandırılmış resim

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getPositionedImages()

PositionedImage nesnenin tümünü paragrafa sabitler.

Return

PositionedImage[] — konumlandırılmış resimlerin listesi

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getPreviousSibling()

Öğenin önceki eşdüzey öğesini alır.

Önceki eşdüzey öğe, aynı üst öğeye sahip ve geçerli öğeden önce geliyor.

Return

Element: Önceki kardeş öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getSpacingAfter()

Öğeden sonraki boşluğu, punto cinsinden alır.

Return

Number - öğeden sonraki boşluk, punto cinsinden

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getSpacingBefore()

Nokta cinsinden öğeden önceki boşluğu alır.

Return

Number — öğeden önceki boşluk, punto cinsinden

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getText()

Öğenin içeriğini bir metin dizesi olarak alır.

Return

String: Metin dizesi olarak öğenin içeriği

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getTextAlignment()

Metin hizalamasını getirir. Kullanılabilir hizalama türleri şunlardır: DocumentApp.TextAlignment.NORMAL, DocumentApp.TextAlignment.SUBSCRIPT ve DocumentApp.TextAlignment.SUPERSCRIPT.

Return

TextAlignment: Metin hizalamasının türü veya metin birden fazla metin türü içeriyorsa null veya metin hizalaması hiç ayarlanmamışsa

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

getType()

Öğenin ElementType değerini alır.

Belirli bir öğenin tam türünü belirlemek için getType() işlevini kullanın.

var doc = DocumentApp.getActiveDocument();
var documentTab = doc.getActiveTab().asDocumentTab();
var body = documentTab.getBody();

// Obtain the first element in the active tab's 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.');
}

Return

ElementType: Öğe türü.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

insertHorizontalRule(childIndex)

HorizontalRule oluşturur ve belirtilen dizine ekler.

Parametreler

AdTürAçıklama
childIndexIntegeröğenin ekleneceği dizin

Return

HorizontalRule — yeni yatay kural öğesi

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

insertInlineImage(childIndex, image)

Belirtilen konumda, belirtilen görüntü blobundan yeni bir InlineImage oluşturur ve ekler dizin.

Parametreler

AdTürAçıklama
childIndexIntegeröğenin ekleneceği dizin
imageBlobSourceResim verileri

Return

InlineImage: Eklenen satır içi resim öğesi

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

insertInlineImage(childIndex, image)

Verilen InlineImage öğesini belirtilen dizine ekler.

Parametreler

AdTürAçıklama
childIndexIntegeröğenin ekleneceği dizin
imageInlineImageResim verileri

Return

InlineImage: Eklenen satır içi resim öğesi

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

insertPageBreak(childIndex)

Yeni bir PageBreak oluşturur ve belirtilen dizine ekler.

Not: PageBreaks, TableCells içinde yer alamaz. Geçerli öğe bir tablo hücresinde yer alıyorsa bir istisna verilir.

Parametreler

AdTürAçıklama
childIndexIntegeröğenin ekleneceği dizin

Return

PageBreak: Yeni sayfa sonu öğesi

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

insertPageBreak(childIndex, pageBreak)

Verilen PageBreak öğesini belirtilen dizine ekler.

Not: PageBreaks, TableCells içinde yer alamaz. Geçerli öğe bir tablo hücresinde yer alıyorsa bir istisna verilir.

Parametreler

AdTürAçıklama
childIndexIntegeröğenin ekleneceği dizin
pageBreakPageBreakp[eklenecek yaş arası

Return

PageBreak: Eklenen sayfa sonu öğesi

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

insertText(childIndex, text)

Yeni bir metin öğesi oluşturur ve belirtilen dizine ekler.

Parametreler

AdTürAçıklama
childIndexIntegeröğenin ekleneceği dizin
textStringmetin içerikleri

Return

Text: Yeni metin öğesi

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

insertText(childIndex, text)

Belirtilen dizine belirtilen Text öğesini, belirtilen metinle ekler içerik.

Parametreler

AdTürAçıklama
childIndexIntegeröğenin ekleneceği dizin
textTexteklenecek metin öğesi

Return

Text: Eklenen metin öğesi

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

isAtDocumentEnd()

Öğenin, Document öğesinin sonunda olup olmadığını belirler.

Return

Boolean — Öğenin sekmenin sonunda olup olmadığı.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

isLeftToRight()

Soldan sağa ayarı alır.

Return

Boolean — soldan sağa ayar

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

merge()

Öğeyi, aynı türden bir önceki kardeş öğeyle birleştirir.

Yalnızca aynı ElementType öğesine ait öğeler birleştirilebilir. Şunda bulunan tüm alt öğeler: geçerli öğe önceki eşdüzey öğeye taşınır.

Geçerli öğe dokümandan kaldırılır.

var doc = DocumentApp.getActiveDocument();
var documentTab = doc.getActiveTab().asDocumentTab();
var body = documentTab.getBody();

// Example 1: Merge paragraphs
// Append two paragraphs to the document's active tab.
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();

Return

Paragraph: Birleştirilmiş öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

removeChild(child)

Belirtilen alt öğeyi kaldırır.

Parametreler

AdTürAçıklama
childElementkaldırılacak alt öğe

Return

Paragraph - geçerli öğe

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

removeFromParent()

Öğeyi üst öğesinden kaldırır.

var doc = DocumentApp.getActiveDocument();
var documentTab = doc.getActiveTab().asDocumentTab()
var body = documentTab.getBody();

// Remove all images in the active tab's body.
var imgs = body.getImages();
for (var i = 0; i < imgs.length; i++) {
  imgs[i].removeFromParent();
}

Return

Paragraph: Kaldırılan öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

removePositionedImage(id)

Resmin kimliğine göre bir PositionedImage kaldırılır.

Parametreler

AdTürAçıklama
idStringresim kimliği

Return

Boolean - belirtilen resmin kaldırılıp kaldırılmadığı

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

replaceText(searchPattern, replacement)

Belirli bir metin kalıbının tüm tekrarlarını, normal değer kullanarak belirli bir değiştirme dizesiyle değiştirir ifade eder.

Arama kalıbı, JavaScript normal ifade nesnesi değil, dize olarak iletilir. Bu nedenle, kalıptaki ters eğik çizgilerden kaçınmanız gerekir.

Bu yöntemler, Google'ın normal RE2 desteklenen söz dizimini sınırlayan ifade kitaplığı için kullanılır.

Sağlanan normal ifade kalıbı her metin bloğuyla bağımsız olarak eşleştirilir öğedir.

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

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

Parametreler

AdTürAçıklama
searchPatternStringaranacak normal ifade kalıbı
replacementStringyerine kullanılacak metin

Return

Element - geçerli öğe

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

setAlignment(alignment)

HorizontalAlignment özelliğini ayarlar.

Parametreler

AdTürAçıklama
alignmentHorizontalAlignmentyatay hizalama

Return

Paragraph - geçerli öğe

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

setAttributes(attributes)

Öğenin özelliklerini ayarlar.

Belirtilen özellikler parametresi, her özellik adının DocumentApp.Attribute sıralaması ve her özellik değeri, geçerlidir.

var doc = DocumentApp.getActiveDocument();
var documentTab = doc.getActiveTab().asDocumentTab();
var body = documentTab.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);

Parametreler

AdTürAçıklama
attributesObjectÖğenin özellikleri.

Return

Paragraph: Geçerli öğe.

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

setHeading(heading)

ParagraphHeading özelliğini ayarlar.

Parametreler

AdTürAçıklama
headingParagraphHeadingbaşlık

Return

Paragraph - geçerli öğe

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

setIndentEnd(indentEnd)

Bitiş girintisini punto olarak ayarlar.

Parametreler

AdTürAçıklama
indentEndNumberbitiş girintisi, punto cinsinden

Return

Paragraph - geçerli öğe

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

setIndentFirstLine(indentFirstLine)

İlk satır girintisini punto olarak ayarlar.

Parametreler

AdTürAçıklama
indentFirstLineNumberpunto cinsinden ilk satır girintisi

Return

Paragraph - geçerli öğe

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

setIndentStart(indentStart)

Başlangıç girintisini punto olarak ayarlar.

Parametreler

AdTürAçıklama
indentStartNumberbaşlangıç girintisi, punto olarak

Return

Paragraph - geçerli öğe

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

setLeftToRight(leftToRight)

Soldan sağa ayarını belirler.

Parametreler

AdTürAçıklama
leftToRightBooleansoldan sağa ayarı

Return

Paragraph - geçerli öğe

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

setLineSpacing(multiplier)

Satır aralığını, boşluk için kullanılacak satır sayısını gösteren bir miktar olarak ayarlar.

Parametreler

AdTürAçıklama
multiplierNumbersatır sayısı

Return

Paragraph - geçerli öğe

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

setLinkUrl(url)

Bağlantı URL'sini ayarlar.

Parametreler

AdTürAçıklama
urlStringbağlantı URL'si

Return

Paragraph - geçerli öğe

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

setSpacingAfter(spacingAfter)

Öğeden sonraki boşluğu punto cinsinden ayarlar.

Parametreler

AdTürAçıklama
spacingAfterNumberöğeden sonraki boşluk, punto cinsinden

Return

Paragraph - geçerli öğe

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

setSpacingBefore(spacingBefore)

Öğeden önceki boşluğu punto cinsinden ayarlar.

Parametreler

AdTürAçıklama
spacingBeforeNumberöğeden önceki boşluk, punto cinsinden

Return

Paragraph - geçerli öğe

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

setText(text)

Paragrafın içeriğini metin olarak ayarlar.

Not: Mevcut içerikler temizlenir.

Parametreler

AdTürAçıklama
textStringyeni metin içerikleri

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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

setTextAlignment(textAlignment)

Metin hizalamasını ayarlar. Kullanılabilir hizalama türleri şunlardır: DocumentApp.TextAlignment.NORMAL, DocumentApp.TextAlignment.SUBSCRIPT ve DocumentApp.TextAlignment.SUPERSCRIPT.

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

Parametreler

AdTürAçıklama
textAlignmentTextAlignmentuygulanacak metin hizalamasının türü

Return

Paragraph - geçerli öğe

Yetkilendirme

Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan bir veya daha fazlasıyla yetkilendirme gerektirir:

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