Sayfa sonunu temsil eden bir öğe. List veya Paragraph bir Table, Header, Footer veya Footnote içinde olmadığı sürece Page bir List veya Paragraph içinde bulunabilir. Page öğesi başka bir öğe içeremez. Belge yapısı hakkında daha fazla bilgi için Google Docs'u genişletme kılavuzuna bakın.
Yöntemler
| Yöntem | Dönüş türü | Kısa açıklama |
|---|---|---|
copy() | Page | Geçerli öğenin ayrılmış, derin bir kopyasını döndürür. |
get | Object | Öğenin özelliklerini alır. |
get | Element | Öğenin sonraki kardeş öğesini alır. |
get | Container | Öğenin üst öğesini alır. |
get | Element | Öğenin önceki kardeş öğesini alır. |
get | Element | Öğenin Element değerini alır. |
is | Boolean | Öğenin Document'ün sonunda olup olmadığını belirler. |
remove | Page | Öğeyi üst öğesinden kaldırır. |
set | Page | Öğenin özelliklerini ayarlar. |
Ayrıntılı dokümanlar
copy()
Geçerli öğenin ayrılmış, derin bir kopyasını döndürür.
Öğede bulunan tüm alt öğeler de kopyalanır. Yeni öğenin üst öğesi yok.
Return
Page: Yeni kopya.
Yetkilendirme
Bu yöntemi kullanan komut dosyalarının aşağıdaki kapsamlardan bir veya daha fazlası için yetkilendirilmesi gerekir:
-
https://www.googleapis.com/auth/documents.currentonly -
https://www.googleapis.com/auth/documents
get Attributes()
Öğenin özelliklerini alır.
Sonuç, her geçerli öğe özelliği için bir özellik içeren bir nesnedir. Bu nesnedeki her özellik adı, Document dizininde bir öğeye karşılık gelir.
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]}`); }
Return
Object: Öğenin özellikleri.
Yetkilendirme
Bu yöntemi kullanan komut dosyalarının aşağıdaki kapsamlardan bir veya daha fazlası için yetkilendirilmesi gerekir:
-
https://www.googleapis.com/auth/documents.currentonly -
https://www.googleapis.com/auth/documents
get Next Sibling()
Öğenin sonraki kardeş öğesini alır.
Bir 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ının aşağıdaki kapsamlardan bir veya daha fazlası için yetkilendirilmesi gerekir:
-
https://www.googleapis.com/auth/documents.currentonly -
https://www.googleapis.com/auth/documents
get Parent()
Öğenin üst öğesini alır.
Üst öğe, geçerli öğeyi içerir.
Return
Container: Üst öğe.
Yetkilendirme
Bu yöntemi kullanan komut dosyalarının aşağıdaki kapsamlardan bir veya daha fazlası için yetkilendirilmesi gerekir:
-
https://www.googleapis.com/auth/documents.currentonly -
https://www.googleapis.com/auth/documents
get Previous Sibling()
Öğenin önceki kardeş öğesini alır.
Önceki kardeş öğe, aynı üst öğeye sahiptir ve geçerli öğeden önce gelir.
Return
Element: Önceki kardeş öğe.
Yetkilendirme
Bu yöntemi kullanan komut dosyalarının aşağıdaki kapsamlardan bir veya daha fazlası için yetkilendirilmesi gerekir:
-
https://www.googleapis.com/auth/documents.currentonly -
https://www.googleapis.com/auth/documents
get Type()
Öğenin Element değerini alır.
Belirli bir öğenin tam türünü belirlemek için get öğesini kullanın.
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.'); }
Return
Element: Öğe türü.
Yetkilendirme
Bu yöntemi kullanan komut dosyalarının aşağıdaki kapsamlardan bir veya daha fazlası için yetkilendirilmesi gerekir:
-
https://www.googleapis.com/auth/documents.currentonly -
https://www.googleapis.com/auth/documents
is At Document End()
Öğenin Document'ün sonunda olup olmadığını belirler.
Return
Boolean: Öğenin sekmenin sonunda olup olmadığı.
Yetkilendirme
Bu yöntemi kullanan komut dosyalarının aşağıdaki kapsamlardan bir veya daha fazlası için yetkilendirilmesi gerekir:
-
https://www.googleapis.com/auth/documents.currentonly -
https://www.googleapis.com/auth/documents
remove From Parent()
Öğeyi üst öğesinden kaldırır.
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(); }
Return
Page: Kaldırılan öğe.
Yetkilendirme
Bu yöntemi kullanan komut dosyalarının aşağıdaki kapsamlardan bir veya daha fazlası için yetkilendirilmesi gerekir:
-
https://www.googleapis.com/auth/documents.currentonly -
https://www.googleapis.com/auth/documents
set Attributes(attributes)
Öğenin özelliklerini ayarlar.
Belirtilen attributes parametresi, her bir özellik adının Document numaralandırmasında bir öğe olduğu ve her bir özellik değerinin uygulanacak yeni değer olduğu bir nesne olmalıdır.
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);
Parametreler
| Ad | Tür | Açıklama |
|---|---|---|
attributes | Object | Öğenin özellikleri. |
Return
Page: Geçerli öğe.
Yetkilendirme
Bu yöntemi kullanan komut dosyalarının aşağıdaki kapsamlardan bir veya daha fazlası için yetkilendirilmesi gerekir:
-
https://www.googleapis.com/auth/documents.currentonly -
https://www.googleapis.com/auth/documents