Document Service

文件

這項服務允許指令碼建立、存取及修改 Google 文件檔案。

// Open a document by ID.
var doc = DocumentApp.openById('DOCUMENT_ID_GOES_HERE');

// Create and open a document.
doc = DocumentApp.create('Document Name');

類別

名稱簡短說明
Attribute元素屬性列舉。
Body代表文件內文的元素。
Bookmark代表書籤的物件。
ContainerElement可能包含其他元素的通用元素。
Date代表格式化日期的元素
Document包含 RTF 格式和元素 (例如表格和清單) 的文件。
DocumentApp文件服務會建立並開啟可以編輯的 Documents
Element一般元素。
ElementType所有元素類型的列舉。
Equation代表數學運算式的元素。
EquationFunction代表數學 Equation 中函式的元素。
EquationFunctionArgumentSeparator代表數學 Equation 中函式分隔符的元素。
EquationSymbol代表數學 Equation 中符號的元素。
FontFamily支援字型列舉。
FooterSection代表頁尾區段的元素。
Footnote代表註腳的元素。
FootnoteSection代表註腳部分的元素。
GlyphType列舉支援的字符類型。
HeaderSection代表標頭區段的元素。
HorizontalAlignment此屬性列舉了支援的水平對齊類型。
HorizontalRule代表水平規則的元素。
InlineDrawing代表嵌入繪圖的元素。
InlineImage代表內嵌圖片的元素。
ListItem代表清單項目的元素。
NamedRange具有名稱和 ID 以供日後擷取的 Range
PageBreak代表分頁符號的元素。
Paragraph代表段落的元素。
ParagraphHeading列舉標準段落標題。
Person這個元素代表使用者的連結。
Position對文件中特定位置的參照 (相對於特定元素)。
PositionedImage固定在 Paragraph 中的固定位置圖片。
PositionedLayout列舉可指定如何根據周圍文字配置 PositionedImage
Range文件中的一系列元素。
RangeBuilder這個建構工具可從文件元素建構 Range 物件。
RangeElement包含可能開始與結束偏移的 Element 包裝函式。
RichLink代表 Google 資源連結的元素,例如雲端硬碟檔案或 YouTube 影片。
Table代表資料表的元素。
TableCell代表表格儲存格的元素。
TableOfContents包含目錄的元素。
TableRow代表表格列的元素。
Text代表 RTF 區域的元素。
TextAlignment文字對齊方式的列舉類型。
UnsupportedElement代表未知區域的元素,或無法透過指令碼影響的區域,例如頁碼。
VerticalAlignment此屬性列舉了支援的垂直對齊類型。

Attribute

屬性

屬性類型說明
BACKGROUND_COLOREnum元素 (段落、表格等) 或文件的背景顏色。
BOLDEnumRTF 格式的字型粗細設定。
BORDER_COLOREnum表格元素的邊框顏色。
BORDER_WIDTHEnum表格元素的框線寬度。
CODEEnum方程式元素的程式碼內容。
FONT_FAMILYEnum字型系列設定,適用於 RTF 格式。
FONT_SIZEEnum點數的字型大小設定 (以 RTF 格式表示)。
FOREGROUND_COLOREnumRTF 格式的前景色彩設定。
HEADINGEnum段落元素的標題類型 (例如 DocumentApp.ParagraphHeading.HEADING1)。
HEIGHTEnum圖片元素的高度設定。
HORIZONTAL_ALIGNMENTEnum段落元素 (例如 DocumentApp.HorizontalAlignment.CENTER) 的水平對齊方式。
INDENT_ENDEnum段落元素的結束縮排設定。
INDENT_FIRST_LINEEnum段落元素的第一行縮排設定。
INDENT_STARTEnum段落元素的開始縮排設定。
ITALICEnumRT 格式的字型樣式設定。
GLYPH_TYPEEnum清單項目元素的字符類型。
LEFT_TO_RIGHTEnumRTF 格式的文字方向設定。
LINE_SPACINGEnum段落元素的行間距設定,設為調節係數。
LINK_URLEnumRTF 格式的連結網址。
LIST_IDEnum涵蓋清單的 ID,適用於清單項目元素。
MARGIN_BOTTOMEnum底部邊界設定 (以點為單位) 適用於段落元素。
MARGIN_LEFTEnum段落元素的左邊界設定。
MARGIN_RIGHTEnum段落元素的右側邊界設定。
MARGIN_TOPEnum段落元素的上邊界設定。
NESTING_LEVELEnum清單項目元素的巢狀層級。
MINIMUM_HEIGHTEnum表格列元素的點下限設定。
PADDING_BOTTOMEnum表格儲存格元素的底部邊框間距設定。
PADDING_LEFTEnum表格儲存格元素的左側邊框間距設定。
PADDING_RIGHTEnum表格儲存格元素的右側邊框間距設定。
PADDING_TOPEnum表格儲存格元素的頂端邊框間距設定。
PAGE_HEIGHTEnum文件的頁面高度設定,以點表示。
PAGE_WIDTHEnum文件的頁面寬度設定 (以點為單位)。
SPACING_AFTEREnum段落元素的底部間距設定 (以點為單位)。
SPACING_BEFOREEnum段落元素的頂端間距設定。
STRIKETHROUGHEnumRTF 格式的刪除線設定。
UNDERLINEEnum底線設定:RTF 格式。
VERTICAL_ALIGNMENTEnum表格儲存格元素的垂直對齊設定。
WIDTHEnum表格儲存格和圖片元素的寬度設定。

Body

方法

方法傳回類型簡短說明
appendHorizontalRule()HorizontalRule建立並附加新的 HorizontalRule
appendImage(image)InlineImage從指定映像檔 blob 建立及附加新的 InlineImage
appendImage(image)InlineImage附加指定的 InlineImage
appendListItem(listItem)ListItem附加指定的 ListItem
appendListItem(text)ListItem建立並附加包含指定文字內容的新 ListItem
appendPageBreak()PageBreak建立並附加新的 PageBreak
appendPageBreak(pageBreak)PageBreak附加指定的 PageBreak
appendParagraph(paragraph)Paragraph附加指定的 Paragraph
appendParagraph(text)Paragraph建立並附加包含指定文字內容的新 Paragraph
appendTable()Table建立並附加新的 Table
appendTable(cells)Table為每個指定字串值附加含有 TableCell 的新 Table
appendTable(table)Table附加指定的 Table
clear()Body清除元素內容。
copy()Body傳回目前元素的卸離的深度副本。
editAsText()Text取得目前元素的 Text 版本進行編輯。
findElement(elementType)RangeElement搜尋指定類型的子系元素內容。
findElement(elementType, from)RangeElement從指定的 RangeElement 開始,搜尋指定類型的子系元素內容。
findText(searchPattern)RangeElement使用規則運算式搜尋元素的內容。
findText(searchPattern, from)RangeElement從特定搜尋結果開始,搜尋指定文字模式的元素內容。
getAttributes()Object擷取元素的屬性。
getChild(childIndex)Element擷取指定子索引的子元素。
getChildIndex(child)Integer擷取指定子元素的子索引。
getHeadingAttributes(paragraphHeading)Object擷取所提供 ParagraphHeading 的屬性組合。
getImages()InlineImage[]擷取區段包含的所有 InlineImages
getListItems()ListItem[]擷取區段包含的所有 ListItems
getMarginBottom()Number擷取點中的下邊界。
getMarginLeft()Number擷取點中的左側邊界。
getMarginRight()Number擷取右側邊界。
getMarginTop()Number擷取上邊界。
getNumChildren()Integer擷取子項的數量。
getPageHeight()Number以時間點擷取頁面高度。
getPageWidth()Number以時間點擷取頁面寬度。
getParagraphs()Paragraph[]擷取區段中包含的所有 Paragraphs (包括 ListItems)。
getParent()ContainerElement擷取元素的父項元素。
getTables()Table[]擷取區段包含的所有 Tables
getText()String以文字字串擷取元素內容。
getTextAlignment()TextAlignment取得文字對齊方式。
getType()ElementType擷取元素的 ElementType
insertHorizontalRule(childIndex)HorizontalRule在指定的索引建立並插入新的 HorizontalRule
insertImage(childIndex, image)InlineImage在指定索引中建立並插入指定映像檔 blob 的 InlineImage
insertImage(childIndex, image)InlineImage在指定的索引處插入指定的 InlineImage
insertListItem(childIndex, listItem)ListItem在指定的索引處插入指定的 ListItem
insertListItem(childIndex, text)ListItem在指定索引中建立及插入含有指定文字內容的新 ListItem
insertPageBreak(childIndex)PageBreak在指定的索引建立並插入新的 PageBreak
insertPageBreak(childIndex, pageBreak)PageBreak在指定的索引處插入指定的 PageBreak
insertParagraph(childIndex, paragraph)Paragraph在指定的索引處插入指定的 Paragraph
insertParagraph(childIndex, text)Paragraph在指定索引中建立及插入含有指定文字內容的新 Paragraph
insertTable(childIndex)Table在指定的索引建立並插入新的 Table
insertTable(childIndex, cells)Table在指定索引處建立及插入含有指定儲存格的新 Table
insertTable(childIndex, table)Table在指定的索引處插入指定的 Table
removeChild(child)Body移除指定的子元素。
replaceText(searchPattern, replacement)Element使用規則運算式,將指定文字模式的所有出現次數替換為指定的替代字串。
setAttributes(attributes)Body設定元素的屬性。
setHeadingAttributes(paragraphHeading, attributes)Body設定所提供 ParagraphHeading 的屬性。
setMarginBottom(marginBottom)Body設定下邊界 (以點為單位)。
setMarginLeft(marginLeft)Body設定左邊界 (以點為單位)。
setMarginRight(marginRight)Body設定右邊界 (以點為單位)。
setMarginTop(marginTop)Body設定上邊界。
setPageHeight(pageHeight)Body設定頁面高度,以點為單位。
setPageWidth(pageWidth)Body設定頁面寬度,以點為單位。
setText(text)Body將內容設為純文字。
setTextAlignment(textAlignment)Body設定文字對齊方式。

Bookmark

方法

方法傳回類型簡短說明
getId()String取得 Bookmark 的 ID。
getPosition()Position取得 DocumentBookmarkPosition
remove()void刪除 Bookmark

ContainerElement

方法

方法傳回類型簡短說明
asBody()Body將目前元素傳回為 Body
asEquation()Equation將目前元素傳回為 Equation
asFooterSection()FooterSection將目前元素傳回為 FooterSection
asFootnoteSection()FootnoteSection將目前元素傳回為 FootnoteSection
asHeaderSection()HeaderSection將目前元素傳回為 HeaderSection
asListItem()ListItem將目前元素傳回為 ListItem
asParagraph()Paragraph將目前元素傳回為 Paragraph
asTable()Table將目前元素傳回為 Table
asTableCell()TableCell將目前元素傳回為 TableCell
asTableOfContents()TableOfContents將目前元素傳回為 TableOfContents
asTableRow()TableRow將目前元素傳回為 TableRow
clear()ContainerElement清除元素內容。
copy()ContainerElement傳回目前元素的卸離的深度副本。
editAsText()Text取得目前元素的 Text 版本進行編輯。
findElement(elementType)RangeElement搜尋指定類型的子系元素內容。
findElement(elementType, from)RangeElement從指定的 RangeElement 開始,搜尋指定類型的子系元素內容。
findText(searchPattern)RangeElement使用規則運算式搜尋元素的內容。
findText(searchPattern, from)RangeElement從特定搜尋結果開始,搜尋指定文字模式的元素內容。
getAttributes()Object擷取元素的屬性。
getChild(childIndex)Element擷取指定子索引的子元素。
getChildIndex(child)Integer擷取指定子元素的子索引。
getLinkUrl()String擷取連結網址。
getNextSibling()Element擷取元素的下一個同層級元素。
getNumChildren()Integer擷取子項的數量。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getText()String以文字字串擷取元素內容。
getTextAlignment()TextAlignment取得文字對齊方式。
getType()ElementType擷取元素的 ElementType
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
merge()ContainerElement將元素與下一個同類型的同層級合併。
removeFromParent()ContainerElement從父項元素中移除元素。
replaceText(searchPattern, replacement)Element使用規則運算式,將指定文字模式的所有出現次數替換為指定的替代字串。
setAttributes(attributes)ContainerElement設定元素的屬性。
setLinkUrl(url)ContainerElement設定連結網址。
setTextAlignment(textAlignment)ContainerElement設定文字對齊方式。

Date

方法

方法傳回類型簡短說明
copy()Date傳回目前元素的卸離的深度副本。
getAttributes()Object擷取元素的屬性。
getDisplayText()String傳回在文件中呈現的顯示值。
getLocale()String傳回顯示值使用的日期語言代碼。
getNextSibling()Element擷取元素的下一個同層級元素。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getTimestamp()Date傳回與日期相關聯的時間戳記。
getType()ElementType擷取元素的 ElementType
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
merge()Date將元素與下一個同類型的同層級合併。
removeFromParent()Date從父項元素中移除元素。
setAttributes(attributes)Date設定元素的屬性。

Document

方法

方法傳回類型簡短說明
addBookmark(position)Bookmark在指定的 Position 加入 Bookmark
addEditor(emailAddress)Document將指定的使用者新增至 Document 的編輯者清單。
addEditor(user)Document將指定的使用者新增至 Document 的編輯者清單。
addEditors(emailAddresses)Document將指定的使用者陣列新增至 Document 的編輯者清單。
addFooter()FooterSection新增文件頁尾區段 (如果不存在)。
addHeader()HeaderSection新增文件標頭區段 (如果沒有的話)。
addNamedRange(name, range)NamedRange新增 NamedRange,也就是具有名稱和 ID 以供日後擷取的 Range
addViewer(emailAddress)Document將指定的使用者新增至 Document 的檢視者清單。
addViewer(user)Document將指定的使用者新增至 Document 的檢視者清單。
addViewers(emailAddresses)Document將指定的使用者陣列新增至 Document 的檢視者清單。
getAs(contentType)Blob擷取目前 Document 內容,做為指定類型的 blob。
getBlob()Blob將目前的 Document 內容擷取為 blob。
getBody()Body擷取使用中文件的 Body
getBookmark(id)Bookmark取得具有指定 ID 的 Bookmark
getBookmarks()Bookmark[]取得文件的所有 Bookmark 物件。
getCursor()Position在使用中的文件中取得使用者的遊標。
getEditors()User[]取得這個 Document 的編輯者清單。
getFooter()FooterSection擷取文件的頁尾部分 (如果有的話)。
getFootnotes()Footnote[]擷取文件內文中的所有 Footnote 元素。
getHeader()HeaderSection擷取文件的標題區段 (如果有的話)。
getId()String擷取文件的專屬 ID。
getLanguage()String取得文件的語言代碼。
getName()String擷取文件標題。
getNamedRangeById(id)NamedRange取得具有指定 ID 的 NamedRange
getNamedRanges()NamedRange[]取得文件的所有 NamedRange 物件。
getNamedRanges(name)NamedRange[]取得文件中所有具有指定名稱的 NamedRange 物件。
getSelection()Range取得使用者在使用文件中的選項。
getSupportedLanguageCodes()String[]取得 Google 文件檔案支援的所有語言代碼。
getUrl()String擷取網址以存取目前文件。
getViewers()User[]取得此Document的檢視者和加註者清單。
newPosition(element, offset)Position建立新的 Position,這是相對於文件中特定元素的位置參照。
newRange()RangeBuilder建立建構工具,用來從文件元素建構 Range 物件。
removeEditor(emailAddress)Document將指定使用者從 Document 的編輯者清單中移除。
removeEditor(user)Document將指定使用者從 Document 的編輯者清單中移除。
removeViewer(emailAddress)Document將特定使用者從「Document」的檢視者和加註者清單中移除。
removeViewer(user)Document將特定使用者從「Document」的檢視者和加註者清單中移除。
saveAndClose()void儲存目前的 Document
setCursor(position)Document根據 Position,在使用中的文件中設定使用者的遊標。
setLanguage(languageCode)Document設定文件的語言代碼。
setName(name)Document設定文件標題。
setSelection(range)Document根據 Range,設定使用者在使用中的文件中選取項目。

DocumentApp

屬性

屬性類型說明
AttributeAttributeAttribute 列舉。
ElementTypeElementTypeElementType 列舉。
FontFamilyFontFamilyFontFamily 列舉。
GlyphTypeGlyphTypeGlyphType 列舉。
HorizontalAlignmentHorizontalAlignmentHorizontalAlignment 列舉。
ParagraphHeadingParagraphHeadingParagraphHeading 列舉。
PositionedLayoutPositionedLayoutPositionedLayout 列舉。
TextAlignmentTextAlignmentTextAlignment 列舉。
VerticalAlignmentVerticalAlignmentVerticalAlignment 列舉。

方法

方法傳回類型簡短說明
create(name)Document建立並傳回新文件。
getActiveDocument()Document傳回指令碼要 container-bound 的文件。
getUi()Ui傳回文件使用者介面環境的執行個體,該環境可讓指令碼新增選單、對話方塊和側欄等功能。
openById(id)Document傳回含有指定 ID 的文件。
openByUrl(url)Document開啟並傳回含有指定網址的文件。

Element

方法

方法傳回類型簡短說明
asBody()Body將目前元素傳回為 Body
asDate()Date將目前元素傳回為 Date
asEquation()Equation將目前元素傳回為 Equation
asEquationFunction()EquationFunction將目前元素傳回為 EquationFunction
asEquationFunctionArgumentSeparator()EquationFunctionArgumentSeparator將目前元素傳回為 EquationFunctionArgumentSeparator
asEquationSymbol()EquationSymbol將目前元素傳回為 EquationSymbol
asFooterSection()FooterSection將目前元素傳回為 FooterSection
asFootnote()Footnote將目前元素傳回為 Footnote
asFootnoteSection()FootnoteSection將目前元素傳回為 FootnoteSection
asHeaderSection()HeaderSection將目前元素傳回為 HeaderSection
asHorizontalRule()HorizontalRule將目前元素傳回為 HorizontalRule
asInlineDrawing()InlineDrawing將目前元素傳回為 InlineDrawing
asInlineImage()InlineImage將目前元素傳回為 InlineImage
asListItem()ListItem將目前元素傳回為 ListItem
asPageBreak()PageBreak將目前元素傳回為 PageBreak
asParagraph()Paragraph將目前元素傳回為 Paragraph
asPerson()Person將目前元素傳回為 Person
asRichLink()RichLink會以 RichLink 的形式傳回目前元素,例如 Google 試算表檔案的連結。
asTable()Table將目前元素傳回為 Table
asTableCell()TableCell將目前元素傳回為 TableCell
asTableOfContents()TableOfContents將目前元素傳回為 TableOfContents
asTableRow()TableRow將目前元素傳回為 TableRow
asText()Text將目前元素傳回為 Text
copy()Element傳回目前元素的卸離的深度副本。
getAttributes()Object擷取元素的屬性。
getNextSibling()Element擷取元素的下一個同層級元素。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getType()ElementType擷取元素的 ElementType
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
merge()Element將元素與下一個同類型的同層級合併。
removeFromParent()Element從父項元素中移除元素。
setAttributes(attributes)Element設定元素的屬性。

ElementType

屬性

屬性類型說明
BODY_SECTIONEnumBody 元素相對應的類型。
COMMENT_SECTIONEnumCommentSection 元素相對應的類型。
DATEEnumDate 元素相對應的類型。
DOCUMENTEnum對應至文件根目錄的類型。
EQUATIONEnumEquation 元素相對應的類型。
EQUATION_FUNCTIONEnumEquationFunction 元素相對應的類型。
EQUATION_FUNCTION_ARGUMENT_SEPARATOREnumEquationFunctionArgumentSeparator 元素相對應的類型。
EQUATION_SYMBOLEnumEquationSymbol 元素相對應的類型。
RICH_LINKEnumRichLink 元素相對應的類型。
FOOTER_SECTIONEnumFooterSection 元素相對應的類型。
FOOTNOTEEnumFootnote 元素相對應的類型。
FOOTNOTE_SECTIONEnumFootnoteSection 元素相對應的類型。
HEADER_SECTIONEnumHeaderSection 元素相對應的類型。
HORIZONTAL_RULEEnumHorizontalRule 元素相對應的類型。
INLINE_DRAWINGEnumInlineDrawing 元素相對應的類型。
INLINE_IMAGEEnumInlineImage 元素相對應的類型。
LIST_ITEMEnumListItem 元素相對應的類型。
PAGE_BREAKEnumPageBreak 元素相對應的類型。
PARAGRAPHEnumParagraph 元素相對應的類型。
PERSONEnumPerson 元素相對應的類型。
TABLEEnumTable 元素相對應的類型。
TABLE_CELLEnumTableCell 元素相對應的類型。
TABLE_OF_CONTENTSEnumTableOfContents 元素相對應的類型。
TABLE_ROWEnumTableRow 元素相對應的類型。
TEXTEnumText 元素相對應的類型。
UNSUPPORTEDEnumUnsupportedElement 對應的類型。

Equation

方法

方法傳回類型簡短說明
clear()Equation清除元素內容。
copy()Equation傳回目前元素的卸離的深度副本。
editAsText()Text取得目前元素的 Text 版本進行編輯。
findElement(elementType)RangeElement搜尋指定類型的子系元素內容。
findElement(elementType, from)RangeElement從指定的 RangeElement 開始,搜尋指定類型的子系元素內容。
findText(searchPattern)RangeElement使用規則運算式搜尋元素的內容。
findText(searchPattern, from)RangeElement從特定搜尋結果開始,搜尋指定文字模式的元素內容。
getAttributes()Object擷取元素的屬性。
getChild(childIndex)Element擷取指定子索引的子元素。
getChildIndex(child)Integer擷取指定子元素的子索引。
getLinkUrl()String擷取連結網址。
getNextSibling()Element擷取元素的下一個同層級元素。
getNumChildren()Integer擷取子項的數量。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getText()String以文字字串擷取元素內容。
getTextAlignment()TextAlignment取得文字對齊方式。
getType()ElementType擷取元素的 ElementType
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
merge()Equation將元素與下一個同類型的同層級合併。
removeFromParent()Equation從父項元素中移除元素。
replaceText(searchPattern, replacement)Element使用規則運算式,將指定文字模式的所有出現次數替換為指定的替代字串。
setAttributes(attributes)Equation設定元素的屬性。
setLinkUrl(url)Equation設定連結網址。
setTextAlignment(textAlignment)Equation設定文字對齊方式。

EquationFunction

方法

方法傳回類型簡短說明
clear()EquationFunction清除元素內容。
copy()EquationFunction傳回目前元素的卸離的深度副本。
editAsText()Text取得目前元素的 Text 版本進行編輯。
findElement(elementType)RangeElement搜尋指定類型的子系元素內容。
findElement(elementType, from)RangeElement從指定的 RangeElement 開始,搜尋指定類型的子系元素內容。
findText(searchPattern)RangeElement使用規則運算式搜尋元素的內容。
findText(searchPattern, from)RangeElement從特定搜尋結果開始,搜尋指定文字模式的元素內容。
getAttributes()Object擷取元素的屬性。
getChild(childIndex)Element擷取指定子索引的子元素。
getChildIndex(child)Integer擷取指定子元素的子索引。
getCode()String擷取與方程式函式相對應的程式碼。
getLinkUrl()String擷取連結網址。
getNextSibling()Element擷取元素的下一個同層級元素。
getNumChildren()Integer擷取子項的數量。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getText()String以文字字串擷取元素內容。
getTextAlignment()TextAlignment取得文字對齊方式。
getType()ElementType擷取元素的 ElementType
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
merge()EquationFunction將元素與下一個同類型的同層級合併。
removeFromParent()EquationFunction從父項元素中移除元素。
replaceText(searchPattern, replacement)Element使用規則運算式,將指定文字模式的所有出現次數替換為指定的替代字串。
setAttributes(attributes)EquationFunction設定元素的屬性。
setLinkUrl(url)EquationFunction設定連結網址。
setTextAlignment(textAlignment)EquationFunction設定文字對齊方式。

EquationFunctionArgumentSeparator

方法

方法傳回類型簡短說明
copy()EquationFunctionArgumentSeparator傳回目前元素的卸離的深度副本。
getAttributes()Object擷取元素的屬性。
getNextSibling()Element擷取元素的下一個同層級元素。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getType()ElementType擷取元素的 ElementType
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
merge()EquationFunctionArgumentSeparator將元素與下一個同類型的同層級合併。
removeFromParent()EquationFunctionArgumentSeparator從父項元素中移除元素。
setAttributes(attributes)EquationFunctionArgumentSeparator設定元素的屬性。

EquationSymbol

方法

方法傳回類型簡短說明
copy()EquationSymbol傳回目前元素的卸離的深度副本。
getAttributes()Object擷取元素的屬性。
getCode()String擷取與方程式符號對應的代碼。
getNextSibling()Element擷取元素的下一個同層級元素。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getType()ElementType擷取元素的 ElementType
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
merge()EquationSymbol將元素與下一個同類型的同層級合併。
removeFromParent()EquationSymbol從父項元素中移除元素。
setAttributes(attributes)EquationSymbol設定元素的屬性。

FontFamily

FooterSection

方法

方法傳回類型簡短說明
appendHorizontalRule()HorizontalRule建立並附加新的 HorizontalRule
appendImage(image)InlineImage從指定映像檔 blob 建立及附加新的 InlineImage
appendImage(image)InlineImage附加指定的 InlineImage
appendListItem(listItem)ListItem附加指定的 ListItem
appendListItem(text)ListItem建立並附加包含指定文字內容的新 ListItem
appendParagraph(paragraph)Paragraph附加指定的 Paragraph
appendParagraph(text)Paragraph建立並附加包含指定文字內容的新 Paragraph
appendTable()Table建立並附加新的 Table
appendTable(cells)Table為每個指定字串值附加含有 TableCell 的新 Table
appendTable(table)Table附加指定的 Table
clear()FooterSection清除元素內容。
copy()FooterSection傳回目前元素的卸離的深度副本。
editAsText()Text取得目前元素的 Text 版本進行編輯。
findElement(elementType)RangeElement搜尋指定類型的子系元素內容。
findElement(elementType, from)RangeElement從指定的 RangeElement 開始,搜尋指定類型的子系元素內容。
findText(searchPattern)RangeElement使用規則運算式搜尋元素的內容。
findText(searchPattern, from)RangeElement從特定搜尋結果開始,搜尋指定文字模式的元素內容。
getAttributes()Object擷取元素的屬性。
getChild(childIndex)Element擷取指定子索引的子元素。
getChildIndex(child)Integer擷取指定子元素的子索引。
getImages()InlineImage[]擷取區段包含的所有 InlineImages
getListItems()ListItem[]擷取區段包含的所有 ListItems
getNumChildren()Integer擷取子項的數量。
getParagraphs()Paragraph[]擷取區段中包含的所有 Paragraphs (包括 ListItems)。
getParent()ContainerElement擷取元素的父項元素。
getTables()Table[]擷取區段包含的所有 Tables
getText()String以文字字串擷取元素內容。
getTextAlignment()TextAlignment取得文字對齊方式。
getType()ElementType擷取元素的 ElementType
insertHorizontalRule(childIndex)HorizontalRule在指定的索引建立並插入新的 HorizontalRule
insertImage(childIndex, image)InlineImage在指定索引中建立並插入指定映像檔 blob 的 InlineImage
insertImage(childIndex, image)InlineImage在指定的索引處插入指定的 InlineImage
insertListItem(childIndex, listItem)ListItem在指定的索引處插入指定的 ListItem
insertListItem(childIndex, text)ListItem在指定索引中建立及插入含有指定文字內容的新 ListItem
insertParagraph(childIndex, paragraph)Paragraph在指定的索引處插入指定的 Paragraph
insertParagraph(childIndex, text)Paragraph在指定索引中建立及插入含有指定文字內容的新 Paragraph
insertTable(childIndex)Table在指定的索引建立並插入新的 Table
insertTable(childIndex, cells)Table在指定索引處建立及插入含有指定儲存格的新 Table
insertTable(childIndex, table)Table在指定的索引處插入指定的 Table
removeChild(child)FooterSection移除指定的子元素。
removeFromParent()FooterSection從父項元素中移除元素。
replaceText(searchPattern, replacement)Element使用規則運算式,將指定文字模式的所有出現次數替換為指定的替代字串。
setAttributes(attributes)FooterSection設定元素的屬性。
setText(text)FooterSection將內容設為純文字。
setTextAlignment(textAlignment)FooterSection設定文字對齊方式。

Footnote

方法

方法傳回類型簡短說明
copy()Footnote傳回目前元素的卸離的深度副本。
getAttributes()Object擷取元素的屬性。
getFootnoteContents()FootnoteSection擷取註腳元素內容。
getNextSibling()Element擷取元素的下一個同層級元素。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getType()ElementType擷取元素的 ElementType
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
removeFromParent()Footnote從父項元素中移除元素。
setAttributes(attributes)Footnote設定元素的屬性。

FootnoteSection

方法

方法傳回類型簡短說明
appendParagraph(paragraph)Paragraph附加指定的 Paragraph
appendParagraph(text)Paragraph建立並附加包含指定文字內容的新 Paragraph
clear()FootnoteSection清除元素內容。
copy()FootnoteSection傳回目前元素的卸離的深度副本。
editAsText()Text取得目前元素的 Text 版本進行編輯。
findElement(elementType)RangeElement搜尋指定類型的子系元素內容。
findElement(elementType, from)RangeElement從指定的 RangeElement 開始,搜尋指定類型的子系元素內容。
findText(searchPattern)RangeElement使用規則運算式搜尋元素的內容。
findText(searchPattern, from)RangeElement從特定搜尋結果開始,搜尋指定文字模式的元素內容。
getAttributes()Object擷取元素的屬性。
getChild(childIndex)Element擷取指定子索引的子元素。
getChildIndex(child)Integer擷取指定子元素的子索引。
getNextSibling()Element擷取元素的下一個同層級元素。
getNumChildren()Integer擷取子項的數量。
getParagraphs()Paragraph[]擷取區段中包含的所有 Paragraphs (包括 ListItems)。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getText()String以文字字串擷取元素內容。
getTextAlignment()TextAlignment取得文字對齊方式。
getType()ElementType擷取元素的 ElementType
insertParagraph(childIndex, paragraph)Paragraph在指定的索引處插入指定的 Paragraph
insertParagraph(childIndex, text)Paragraph在指定索引中建立及插入含有指定文字內容的新 Paragraph
removeChild(child)FootnoteSection移除指定的子元素。
removeFromParent()FootnoteSection從父項元素中移除元素。
replaceText(searchPattern, replacement)Element使用規則運算式,將指定文字模式的所有出現次數替換為指定的替代字串。
setAttributes(attributes)FootnoteSection設定元素的屬性。
setText(text)FootnoteSection將內容設為純文字。
setTextAlignment(textAlignment)FootnoteSection設定文字對齊方式。

GlyphType

屬性

屬性類型說明
BULLETEnum預設項目符號、圓形和實心。
HOLLOW_BULLETEnum空心項目符號。
SQUARE_BULLETEnum方形項目符號。
NUMBEREnum以數字為基礎的項目符號。
LATIN_UPPEREnum大寫拉丁字母。
LATIN_LOWEREnum小寫拉丁字母。
ROMAN_UPPEREnum羅馬數字、大寫項目符號。
ROMAN_LOWEREnum羅馬數字和小寫項目符號。

HeaderSection

方法

方法傳回類型簡短說明
appendHorizontalRule()HorizontalRule建立並附加新的 HorizontalRule
appendImage(image)InlineImage從指定映像檔 blob 建立及附加新的 InlineImage
appendImage(image)InlineImage附加指定的 InlineImage
appendListItem(listItem)ListItem附加指定的 ListItem
appendListItem(text)ListItem建立並附加包含指定文字內容的新 ListItem
appendParagraph(paragraph)Paragraph附加指定的 Paragraph
appendParagraph(text)Paragraph建立並附加包含指定文字內容的新 Paragraph
appendTable()Table建立並附加新的 Table
appendTable(cells)Table為每個指定字串值附加含有 TableCell 的新 Table
appendTable(table)Table附加指定的 Table
clear()HeaderSection清除元素內容。
copy()HeaderSection傳回目前元素的卸離的深度副本。
editAsText()Text取得目前元素的 Text 版本進行編輯。
findElement(elementType)RangeElement搜尋指定類型的子系元素內容。
findElement(elementType, from)RangeElement從指定的 RangeElement 開始,搜尋指定類型的子系元素內容。
findText(searchPattern)RangeElement使用規則運算式搜尋元素的內容。
findText(searchPattern, from)RangeElement從特定搜尋結果開始,搜尋指定文字模式的元素內容。
getAttributes()Object擷取元素的屬性。
getChild(childIndex)Element擷取指定子索引的子元素。
getChildIndex(child)Integer擷取指定子元素的子索引。
getImages()InlineImage[]擷取區段包含的所有 InlineImages
getListItems()ListItem[]擷取區段包含的所有 ListItems
getNumChildren()Integer擷取子項的數量。
getParagraphs()Paragraph[]擷取區段中包含的所有 Paragraphs (包括 ListItems)。
getParent()ContainerElement擷取元素的父項元素。
getTables()Table[]擷取區段包含的所有 Tables
getText()String以文字字串擷取元素內容。
getTextAlignment()TextAlignment取得文字對齊方式。
getType()ElementType擷取元素的 ElementType
insertHorizontalRule(childIndex)HorizontalRule在指定的索引建立並插入新的 HorizontalRule
insertImage(childIndex, image)InlineImage在指定索引中建立並插入指定映像檔 blob 的 InlineImage
insertImage(childIndex, image)InlineImage在指定的索引處插入指定的 InlineImage
insertListItem(childIndex, listItem)ListItem在指定的索引處插入指定的 ListItem
insertListItem(childIndex, text)ListItem在指定索引中建立及插入含有指定文字內容的新 ListItem
insertParagraph(childIndex, paragraph)Paragraph在指定的索引處插入指定的 Paragraph
insertParagraph(childIndex, text)Paragraph在指定索引中建立及插入含有指定文字內容的新 Paragraph
insertTable(childIndex)Table在指定的索引建立並插入新的 Table
insertTable(childIndex, cells)Table在指定索引處建立及插入含有指定儲存格的新 Table
insertTable(childIndex, table)Table在指定的索引處插入指定的 Table
removeChild(child)HeaderSection移除指定的子元素。
removeFromParent()HeaderSection從父項元素中移除元素。
replaceText(searchPattern, replacement)Element使用規則運算式,將指定文字模式的所有出現次數替換為指定的替代字串。
setAttributes(attributes)HeaderSection設定元素的屬性。
setText(text)HeaderSection將內容設為純文字。
setTextAlignment(textAlignment)HeaderSection設定文字對齊方式。

HorizontalAlignment

屬性

屬性類型說明
LEFTEnum靠左對齊選項。
CENTEREnum置中對齊選項。
RIGHTEnum靠右對齊選項。
JUSTIFYEnum左右對齊選項。

HorizontalRule

方法

方法傳回類型簡短說明
copy()HorizontalRule傳回目前元素的卸離的深度副本。
getAttributes()Object擷取元素的屬性。
getNextSibling()Element擷取元素的下一個同層級元素。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getType()ElementType擷取元素的 ElementType
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
removeFromParent()HorizontalRule從父項元素中移除元素。
setAttributes(attributes)HorizontalRule設定元素的屬性。

InlineDrawing

方法

方法傳回類型簡短說明
copy()InlineDrawing傳回目前元素的卸離的深度副本。
getAltDescription()String傳回繪圖的替代說明。
getAltTitle()String傳回繪圖的替代標題。
getAttributes()Object擷取元素的屬性。
getNextSibling()Element擷取元素的下一個同層級元素。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getType()ElementType擷取元素的 ElementType
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
merge()InlineDrawing將元素與下一個同類型的同層級合併。
removeFromParent()InlineDrawing從父項元素中移除元素。
setAltDescription(description)InlineDrawing設定繪圖的替代說明。
setAltTitle(title)InlineDrawing設定繪圖的替代標題。
setAttributes(attributes)InlineDrawing設定元素的屬性。

InlineImage

方法

方法傳回類型簡短說明
copy()InlineImage傳回目前元素的卸離的深度副本。
getAltDescription()String傳回圖像的替代說明。
getAltTitle()String傳回圖片的替代標題。
getAs(contentType)Blob傳回這個物件內的資料,做為轉換為指定內容類型的 blob。
getAttributes()Object擷取元素的屬性。
getBlob()Blob以 blob 傳回這個物件內的資料。
getHeight()Integer擷取圖片的高度 (以像素為單位)。
getLinkUrl()String擷取連結網址。
getNextSibling()Element擷取元素的下一個同層級元素。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getType()ElementType擷取元素的 ElementType
getWidth()Integer擷取圖片的寬度 (以像素為單位)。
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
merge()InlineImage將元素與下一個同類型的同層級合併。
removeFromParent()InlineImage從父項元素中移除元素。
setAltDescription(description)InlineImage設定圖片的替代說明。
setAltTitle(title)InlineImage設定圖片的替代標題。
setAttributes(attributes)InlineImage設定元素的屬性。
setHeight(height)InlineImage設定圖片的高度 (以像素為單位)。
setLinkUrl(url)InlineImage設定連結網址。
setWidth(width)InlineImage設定圖片的寬度 (以像素為單位)。

ListItem

方法

方法傳回類型簡短說明
addPositionedImage(image)PositionedImage從指定的圖片 blob 建立及插入新的 PositionedImage
appendHorizontalRule()HorizontalRule建立並附加新的 HorizontalRule
appendInlineImage(image)InlineImage從指定映像檔 blob 建立及附加新的 InlineImage
appendInlineImage(image)InlineImage附加指定的 InlineImage
appendPageBreak()PageBreak建立並附加新的 PageBreak
appendPageBreak(pageBreak)PageBreak附加指定的 PageBreak
appendText(text)Text建立並附加含有指定內容的新 Text 元素。
appendText(text)Text附加指定的 Text 元素。
clear()ListItem清除元素內容。
copy()ListItem傳回目前元素的卸離的深度副本。
editAsText()Text取得目前元素的 Text 版本進行編輯。
findElement(elementType)RangeElement搜尋指定類型的子系元素內容。
findElement(elementType, from)RangeElement從指定的 RangeElement 開始,搜尋指定類型的子系元素內容。
findText(searchPattern)RangeElement使用規則運算式搜尋元素的內容。
findText(searchPattern, from)RangeElement從特定搜尋結果開始,搜尋指定文字模式的元素內容。
getAlignment()HorizontalAlignment擷取 HorizontalAlignment
getAttributes()Object擷取元素的屬性。
getChild(childIndex)Element擷取指定子索引的子元素。
getChildIndex(child)Integer擷取指定子元素的子索引。
getGlyphType()GlyphType擷取清單項目的 GlyphType
getHeading()ParagraphHeading擷取 ParagraphHeading
getIndentEnd()Number擷取時間點中的結尾縮排。
getIndentFirstLine()Number在點內擷取首行縮排。
getIndentStart()Number擷取起始縮排。
getLineSpacing()Number擷取點中的行間距。
getLinkUrl()String擷取連結網址。
getListId()String擷取清單 ID。
getNestingLevel()Integer擷取清單項目的巢狀層級。
getNextSibling()Element擷取元素的下一個同層級元素。
getNumChildren()Integer擷取子項的數量。
getParent()ContainerElement擷取元素的父項元素。
getPositionedImage(id)PositionedImage依據圖片 ID 取得 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()ListItem將元素與下一個同類型的同層級合併。
removeChild(child)ListItem移除指定的子元素。
removeFromParent()ListItem從父項元素中移除元素。
removePositionedImage(id)Boolean依據圖片 ID 移除 PositionedImage
replaceText(searchPattern, replacement)Element使用規則運算式,將指定文字模式的所有出現次數替換為指定的替代字串。
setAlignment(alignment)ListItem可設定 HorizontalAlignment
setAttributes(attributes)ListItem設定元素的屬性。
setGlyphType(glyphType)ListItem設定清單項目的 GlyphType
setHeading(heading)ListItem可設定 ParagraphHeading
setIndentEnd(indentEnd)ListItem設定結束縮排 (以點為單位)。
setIndentFirstLine(indentFirstLine)ListItem設定第一行縮排 (以點為單位)。
setIndentStart(indentStart)ListItem設定起始縮排 (以點為單位)。
setLeftToRight(leftToRight)ListItem設定由左至右的設定。
setLineSpacing(multiplier)ListItem設定行距,以數量表示要用於間距的行數。
setLinkUrl(url)ListItem設定連結網址。
setListId(listItem)ListItem設定名單 ID。
setNestingLevel(nestingLevel)ListItem設定清單項目的巢狀層級。
setSpacingAfter(spacingAfter)ListItem設定元素後方的間距 (以點為單位)。
setSpacingBefore(spacingBefore)ListItem設定元素前方的間距 (以點為單位)。
setText(text)void將清單項目的內容設為文字。
setTextAlignment(textAlignment)ListItem設定文字對齊方式。

NamedRange

方法

方法傳回類型簡短說明
getId()String取得此 NamedRange 的 ID。
getName()String取得這個 NamedRange 的名稱。
getRange()Range取得與這個 NamedRange 相關聯的元素範圍。
remove()void從文件中移除這個 NamedRange

PageBreak

方法

方法傳回類型簡短說明
copy()PageBreak傳回目前元素的卸離的深度副本。
getAttributes()Object擷取元素的屬性。
getNextSibling()Element擷取元素的下一個同層級元素。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getType()ElementType擷取元素的 ElementType
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
removeFromParent()PageBreak從父項元素中移除元素。
setAttributes(attributes)PageBreak設定元素的屬性。

Paragraph

方法

方法傳回類型簡短說明
addPositionedImage(image)PositionedImage從指定的圖片 blob 建立及插入新的 PositionedImage
appendHorizontalRule()HorizontalRule建立並附加新的 HorizontalRule
appendInlineImage(image)InlineImage從指定映像檔 blob 建立及附加新的 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)RangeElement從指定的 RangeElement 開始,搜尋指定類型的子系元素內容。
findText(searchPattern)RangeElement使用規則運算式搜尋元素的內容。
findText(searchPattern, from)RangeElement從特定搜尋結果開始,搜尋指定文字模式的元素內容。
getAlignment()HorizontalAlignment擷取 HorizontalAlignment
getAttributes()Object擷取元素的屬性。
getChild(childIndex)Element擷取指定子索引的子元素。
getChildIndex(child)Integer擷取指定子元素的子索引。
getHeading()ParagraphHeading擷取 ParagraphHeading
getIndentEnd()Number擷取時間點中的結尾縮排。
getIndentFirstLine()Number在點內擷取首行縮排。
getIndentStart()Number擷取起始縮排。
getLineSpacing()Number擷取點中的行間距。
getLinkUrl()String擷取連結網址。
getNextSibling()Element擷取元素的下一個同層級元素。
getNumChildren()Integer擷取子項的數量。
getParent()ContainerElement擷取元素的父項元素。
getPositionedImage(id)PositionedImage依據圖片 ID 取得 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依據圖片 ID 移除 PositionedImage
replaceText(searchPattern, replacement)Element使用規則運算式,將指定文字模式的所有出現次數替換為指定的替代字串。
setAlignment(alignment)Paragraph可設定 HorizontalAlignment
setAttributes(attributes)Paragraph設定元素的屬性。
setHeading(heading)Paragraph可設定 ParagraphHeading
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設定文字對齊方式。

ParagraphHeading

屬性

屬性類型說明
NORMALEnum一般文字的標題選項。
HEADING1Enum最高的標題選項。
HEADING2Enum第二個標題選項。
HEADING3Enum第三個標題選項
HEADING4Enum第四個標題選項。
HEADING5Enum第五個標題選項。
HEADING6Enum最下方的標題選項。
TITLEEnum標題選項。
SUBTITLEEnum副標題選項。

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設定元素的屬性。

Position

方法

方法傳回類型簡短說明
getElement()Element取得包含此 Position 的元素。
getOffset()Integer在包含此 Position 的元素中取得其相對位置。
getSurroundingText()Text建立人工 Text 元素,代表包含 PositionParagraphListItem (直接或透過子項元素鏈結) 的文字和格式。
getSurroundingTextOffset()IntegergetSurroundingText() 傳回的 Text 元素中,取得這個 Position 的偏移值。
insertBookmark()Bookmark在這個 Position 建立及插入新的 Bookmark
insertInlineImage(image)InlineImage在這個 Position 從指定的圖片 blob 建立及插入新的 InlineImage
insertText(text)Text在這個 Position 插入指定文字。

PositionedImage

方法

方法傳回類型簡短說明
getAs(contentType)Blob傳回這個物件內的資料,做為轉換為指定內容類型的 blob。
getBlob()Blob以 blob 傳回這個物件內的資料。
getHeight()Integer擷取圖片的高度 (以像素為單位)。
getId()String取得圖片的 ID。
getLayout()PositionedLayout取得列舉值,代表圖片的配置方式。
getLeftOffset()Number從段落左側取得圖片的偏移值 (以點為單位)。
getParagraph()Paragraph取得固定圖片的 Paragraph
getTopOffset()Number從段落頂端取得圖片的偏移量,以該點為單位。
getWidth()Integer擷取圖片的寬度 (以像素為單位)。
setHeight(height)PositionedImage設定圖片的高度 (以像素為單位)。
setLayout(layout)PositionedImage設定圖片的配置方式。
setLeftOffset(offset)PositionedImage設定圖片從段落左側的偏移值。
setTopOffset(offset)PositionedImage設定圖片從段落頂端開始的偏移值。
setWidth(width)PositionedImage設定圖片的寬度 (以像素為單位)。

PositionedLayout

屬性

屬性類型說明
ABOVE_TEXTEnum圖片位於文字上方。
BREAK_BOTHEnum圖片會斷言左右兩側文字。
BREAK_LEFTEnum圖片會中斷左側文字。
BREAK_RIGHTEnum圖片會中斷右側文字。
WRAP_TEXTEnum圖片會以文字包圍。

Range

方法

方法傳回類型簡短說明
getRangeElements()RangeElement[]取得這個 Range 中的所有元素,包括任何部分 Text 元素 (例如,如果選取項目只包含部分 Text 元素)。

RangeBuilder

方法

方法傳回類型簡短說明
addElement(element)RangeBuilder將整個 Element 新增至此 RangeBuilder
addElement(textElement, startOffset, endOffsetInclusive)RangeBuilder將部分 Text 元素新增至這個 RangeBuilder
addElementsBetween(startElement, endElementInclusive)RangeBuilder將兩個完整元素,以及兩個元素之間的所有元素新增至此 RangeBuilder
addElementsBetween(startTextElement, startOffset, endTextElementInclusive, endOffsetInclusive)RangeBuilder將兩個部分 Text 元素,以及兩個元素之間的所有元素新增至 RangeBuilder
addRange(range)RangeBuilder將其他 Range 的內容新增至此 RangeBuilder
build()Range根據套用至建構工具的設定建構 Range
getRangeElements()RangeElement[]取得這個 Range 中的所有元素,包括任何部分 Text 元素 (例如,如果選取項目只包含部分 Text 元素)。

RangeElement

方法

方法傳回類型簡短說明
getElement()Element取得與此 RangeElement 對應的 Element
getEndOffsetInclusive()Integer取得範圍元素中部分範圍的結尾位置。
getStartOffset()Integer取得範圍元素中部分範圍的起始位置。
isPartial()Boolean決定這個範圍元素要涵蓋整個元素還是局部選取的元素字元。

方法

方法傳回類型簡短說明
copy()RichLink傳回目前元素的卸離的深度副本。
getAttributes()Object擷取元素的屬性。
getMimeType()String傳回連結的 MIME 類型,當項目是雲端硬碟檔案的連結時,即可使用此類型;如果不是,則傳回 null
getNextSibling()Element擷取元素的下一個同層級元素。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getTitle()String傳回連結顯示的標題。
getType()ElementType擷取元素的 ElementType
getUrl()String傳回資源的網址。
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
merge()RichLink將元素與下一個同類型的同層級合併。
removeFromParent()RichLink從父項元素中移除元素。
setAttributes(attributes)RichLink設定元素的屬性。

Table

方法

方法傳回類型簡短說明
appendTableRow()TableRow建立並附加新的 TableRow
appendTableRow(tableRow)TableRow附加指定的 TableRow
clear()Table清除元素內容。
copy()Table傳回目前元素的卸離的深度副本。
editAsText()Text取得目前元素的 Text 版本進行編輯。
findElement(elementType)RangeElement搜尋指定類型的子系元素內容。
findElement(elementType, from)RangeElement從指定的 RangeElement 開始,搜尋指定類型的子系元素內容。
findText(searchPattern)RangeElement使用規則運算式搜尋元素的內容。
findText(searchPattern, from)RangeElement從特定搜尋結果開始,搜尋指定文字模式的元素內容。
getAttributes()Object擷取元素的屬性。
getBorderColor()String擷取邊框顏色。
getBorderWidth()Number擷取點的邊框寬度。
getCell(rowIndex, cellIndex)TableCell在指定的資料列和儲存格索引擷取 TableCell
getChild(childIndex)Element擷取指定子索引的子元素。
getChildIndex(child)Integer擷取指定子元素的子索引。
getColumnWidth(columnIndex)Number擷取點中指定資料表欄的寬度。
getLinkUrl()String擷取連結網址。
getNextSibling()Element擷取元素的下一個同層級元素。
getNumChildren()Integer擷取子項的數量。
getNumRows()Integer擷取 TableRows 的數量。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getRow(rowIndex)TableRow擷取指定資料列索引處的 TableRow
getText()String以文字字串擷取元素內容。
getTextAlignment()TextAlignment取得文字對齊方式。
getType()ElementType擷取元素的 ElementType
insertTableRow(childIndex)TableRow在指定的索引建立並插入新的 TableRow
insertTableRow(childIndex, tableRow)TableRow在指定的索引處插入指定的 TableRow
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
removeChild(child)Table移除指定的子元素。
removeFromParent()Table從父項元素中移除元素。
removeRow(rowIndex)TableRow移除指定資料列索引處的 TableRow
replaceText(searchPattern, replacement)Element使用規則運算式,將指定文字模式的所有出現次數替換為指定的替代字串。
setAttributes(attributes)Table設定元素的屬性。
setBorderColor(color)Table設定邊框顏色。
setBorderWidth(width)Table設定框線寬度 (以點為單位)。
setColumnWidth(columnIndex, width)Table設定指定資料欄的寬度 (以點為單位)。
setLinkUrl(url)Table設定連結網址。
setTextAlignment(textAlignment)Table設定文字對齊方式。

TableCell

方法

方法傳回類型簡短說明
appendHorizontalRule()HorizontalRule建立並附加新的 HorizontalRule
appendImage(image)InlineImage從指定映像檔 blob 建立及附加新的 InlineImage
appendImage(image)InlineImage附加指定的 InlineImage
appendListItem(listItem)ListItem附加指定的 ListItem
appendListItem(text)ListItem建立並附加新的 ListItem
appendParagraph(paragraph)Paragraph附加指定的 Paragraph
appendParagraph(text)Paragraph建立並附加新的 Paragraph
appendTable()Table建立並附加新的 Table
appendTable(cells)Table附加包含指定儲存格的新 Table
appendTable(table)Table附加指定的 Table
clear()TableCell清除元素內容。
copy()TableCell傳回目前元素的卸離的深度副本。
editAsText()Text取得目前元素的 Text 版本進行編輯。
findElement(elementType)RangeElement搜尋指定類型的子系元素內容。
findElement(elementType, from)RangeElement從指定的 RangeElement 開始,搜尋指定類型的子系元素內容。
findText(searchPattern)RangeElement使用規則運算式搜尋元素的內容。
findText(searchPattern, from)RangeElement從特定搜尋結果開始,搜尋指定文字模式的元素內容。
getAttributes()Object擷取元素的屬性。
getBackgroundColor()String擷取背景顏色。
getChild(childIndex)Element擷取指定子索引的子元素。
getChildIndex(child)Integer擷取指定子元素的子索引。
getColSpan()Integer擷取資料欄時距,也就是這個儲存格範圍的表格儲存格欄數。
getLinkUrl()String擷取連結網址。
getNextSibling()Element擷取元素的下一個同層級元素。
getNumChildren()Integer擷取子項的數量。
getPaddingBottom()Number擷取點中的底部邊框間距。
getPaddingLeft()Number擷取點中的左側邊框間距。
getPaddingRight()Number擷取點中的右側邊框間距。
getPaddingTop()Number擷取點中的頂部邊框間距。
getParent()ContainerElement擷取元素的父項元素。
getParentRow()TableRow擷取包含目前 TableCellTableRow
getParentTable()Table擷取包含目前 TableCellTable
getPreviousSibling()Element擷取元素先前的同層級元素。
getRowSpan()Integer擷取列跨距,也就是這個儲存格橫跨的表格儲存格列數。
getText()String以文字字串擷取元素內容。
getTextAlignment()TextAlignment取得文字對齊方式。
getType()ElementType擷取元素的 ElementType
getVerticalAlignment()VerticalAlignment擷取 VerticalAlignment
getWidth()Number擷取點,擷取包含儲存格的資料欄寬度。
insertHorizontalRule(childIndex)HorizontalRule在指定的索引建立並插入新的 HorizontalRule
insertImage(childIndex, image)InlineImage在指定索引中建立並插入指定映像檔 blob 的 InlineImage
insertImage(childIndex, image)InlineImage在指定的索引處插入指定的 InlineImage
insertListItem(childIndex, listItem)ListItem在指定的索引處插入指定的 ListItem
insertListItem(childIndex, text)ListItem在指定的索引建立並插入新的 ListItem
insertParagraph(childIndex, paragraph)Paragraph在指定的索引處插入指定的 Paragraph
insertParagraph(childIndex, text)Paragraph在指定的索引建立並插入新的 Paragraph
insertTable(childIndex)Table在指定的索引建立並插入新的 Table
insertTable(childIndex, cells)Table在指定索引處建立及插入含有指定儲存格的新 Table
insertTable(childIndex, table)Table在指定的索引處插入指定的 Table
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
merge()TableCell將元素與下一個同類型的同層級合併。
removeChild(child)TableCell移除指定的子元素。
removeFromParent()TableCell從父項元素中移除元素。
replaceText(searchPattern, replacement)Element使用規則運算式,將指定文字模式的所有出現次數替換為指定的替代字串。
setAttributes(attributes)TableCell設定元素的屬性。
setBackgroundColor(color)TableCell設定背景顏色。
setLinkUrl(url)TableCell設定連結網址。
setPaddingBottom(paddingBottom)TableCell設定底部邊框間距 (以點為單位)。
setPaddingLeft(paddingLeft)TableCell設定左側邊框間距 (以點為單位)。
setPaddingRight(paddingRight)TableCell設定點的右側邊框間距。
setPaddingTop(paddingTop)TableCell設定頂端邊框間距 (以點為單位)。
setText(text)TableCell將內容設為純文字。
setTextAlignment(textAlignment)TableCell設定文字對齊方式。
setVerticalAlignment(alignment)TableCell設定垂直對齊。
setWidth(width)TableCell設定包含目前儲存格的欄寬度 (以點為單位)。

TableOfContents

方法

方法傳回類型簡短說明
clear()TableOfContents清除元素內容。
copy()TableOfContents傳回目前元素的卸離的深度副本。
editAsText()Text取得目前元素的 Text 版本進行編輯。
findElement(elementType)RangeElement搜尋指定類型的子系元素內容。
findElement(elementType, from)RangeElement從指定的 RangeElement 開始,搜尋指定類型的子系元素內容。
findText(searchPattern)RangeElement使用規則運算式搜尋元素的內容。
findText(searchPattern, from)RangeElement從特定搜尋結果開始,搜尋指定文字模式的元素內容。
getAttributes()Object擷取元素的屬性。
getChild(childIndex)Element擷取指定子索引的子元素。
getChildIndex(child)Integer擷取指定子元素的子索引。
getLinkUrl()String擷取連結網址。
getNextSibling()Element擷取元素的下一個同層級元素。
getNumChildren()Integer擷取子項的數量。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getText()String以文字字串擷取元素內容。
getTextAlignment()TextAlignment取得文字對齊方式。
getType()ElementType擷取元素的 ElementType
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
removeFromParent()TableOfContents從父項元素中移除元素。
replaceText(searchPattern, replacement)Element使用規則運算式,將指定文字模式的所有出現次數替換為指定的替代字串。
setAttributes(attributes)TableOfContents設定元素的屬性。
setLinkUrl(url)TableOfContents設定連結網址。
setTextAlignment(textAlignment)TableOfContents設定文字對齊方式。

TableRow

方法

方法傳回類型簡短說明
appendTableCell()TableCell建立並附加新的 TableCell
appendTableCell(textContents)TableCell附加包含指定文字的指定 TableCell
appendTableCell(tableCell)TableCell附加指定的 TableCell
clear()TableRow清除元素內容。
copy()TableRow傳回目前元素的卸離的深度副本。
editAsText()Text取得目前元素的 Text 版本進行編輯。
findElement(elementType)RangeElement搜尋指定類型的子系元素內容。
findElement(elementType, from)RangeElement從指定的 RangeElement 開始,搜尋指定類型的子系元素內容。
findText(searchPattern)RangeElement使用規則運算式搜尋元素的內容。
findText(searchPattern, from)RangeElement從特定搜尋結果開始,搜尋指定文字模式的元素內容。
getAttributes()Object擷取元素的屬性。
getCell(cellIndex)TableCell擷取指定儲存格索引處的 TableCell
getChild(childIndex)Element擷取指定子索引的子元素。
getChildIndex(child)Integer擷取指定子元素的子索引。
getLinkUrl()String擷取連結網址。
getMinimumHeight()Number擷取點的最小高度。
getNextSibling()Element擷取元素的下一個同層級元素。
getNumCells()Integer擷取資料列中的儲存格數量。
getNumChildren()Integer擷取子項的數量。
getParent()ContainerElement擷取元素的父項元素。
getParentTable()Table擷取包含目前資料列的 Table
getPreviousSibling()Element擷取元素先前的同層級元素。
getText()String以文字字串擷取元素內容。
getTextAlignment()TextAlignment取得文字對齊方式。
getType()ElementType擷取元素的 ElementType
insertTableCell(childIndex)TableCell在指定的索引建立並插入新的 TableCell
insertTableCell(childIndex, textContents)TableCell在指定索引處插入指定的 TableCell,其中包含指定文字。
insertTableCell(childIndex, tableCell)TableCell在指定的索引處插入指定的 TableCell
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
merge()TableRow將元素與下一個同類型的同層級合併。
removeCell(cellIndex)TableCell移除指定儲存格索引處的 TableCell
removeChild(child)TableRow移除指定的子元素。
removeFromParent()TableRow從父項元素中移除元素。
replaceText(searchPattern, replacement)Element使用規則運算式,將指定文字模式的所有出現次數替換為指定的替代字串。
setAttributes(attributes)TableRow設定元素的屬性。
setLinkUrl(url)TableRow設定連結網址。
setMinimumHeight(minHeight)TableRow設定最小高度 (以點為單位)。
setTextAlignment(textAlignment)TableRow設定文字對齊方式。

Text

方法

方法傳回類型簡短說明
appendText(text)Text將指定文字加到這個文字區域結尾。
copy()Text傳回目前元素的卸離的深度副本。
deleteText(startOffset, endOffsetInclusive)Text刪除特定範圍的文字。
editAsText()Text取得目前元素的 Text 版本進行編輯。
findText(searchPattern)RangeElement使用規則運算式搜尋元素的內容。
findText(searchPattern, from)RangeElement從特定搜尋結果開始,搜尋指定文字模式的元素內容。
getAttributes()Object擷取元素的屬性。
getAttributes(offset)Object擷取指定字元偏移值的屬性。
getBackgroundColor()String擷取背景顏色設定。
getBackgroundColor(offset)String根據指定的字元偏移值擷取背景顏色。
getFontFamily()String擷取字型系列設定。
getFontFamily(offset)String根據指定的字元偏移值擷取字型系列。
getFontSize()Number擷取字型大小設定。
getFontSize(offset)Number以指定的字元偏移值擷取字型大小。
getForegroundColor()String擷取前景色彩設定。
getForegroundColor(offset)String根據指定的字元偏移值擷取前景顏色。
getLinkUrl()String擷取連結網址。
getLinkUrl(offset)String在指定字元偏移值擷取連結網址。
getNextSibling()Element擷取元素的下一個同層級元素。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getText()String以文字字串擷取元素內容。
getTextAlignment()TextAlignment取得文字對齊方式。
getTextAlignment(offset)TextAlignment取得單一字元的文字對齊方式。
getTextAttributeIndices()Integer[]擷取與不同文字格式設定開始相對應的文字索引組合。
getType()ElementType擷取元素的 ElementType
insertText(offset, text)Text在指定字元偏移處插入指定文字。
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
isBold()Boolean擷取粗體設定。
isBold(offset)Boolean在指定字元偏移值擷取粗體設定。
isItalic()Boolean擷取斜體設定。
isItalic(offset)Boolean根據指定的字元偏移值擷取斜體設定。
isStrikethrough()Boolean擷取刪除線設定。
isStrikethrough(offset)Boolean擷取指定的字元偏移值刪除刪除線設定。
isUnderline()Boolean擷取底線設定。
isUnderline(offset)Boolean擷取指定字元偏移值的底線設定。
merge()Text將元素與下一個同類型的同層級合併。
removeFromParent()Text從父項元素中移除元素。
replaceText(searchPattern, replacement)Element使用規則運算式,將指定文字模式的所有出現次數替換為指定的替代字串。
setAttributes(startOffset, endOffsetInclusive, attributes)Text將指定屬性套用至指定的字元範圍。
setAttributes(attributes)Text設定元素的屬性。
setBackgroundColor(startOffset, endOffsetInclusive, color)Text設定指定的字元範圍背景顏色。
setBackgroundColor(color)Text設定背景顏色。
setBold(bold)Text用於設定粗體設定。
setBold(startOffset, endOffsetInclusive, bold)Text為指定字元範圍設定粗體設定。
setFontFamily(startOffset, endOffsetInclusive, fontFamilyName)Text設定指定字元範圍的字型系列。
setFontFamily(fontFamilyName)Text設定字型系列。
setFontSize(startOffset, endOffsetInclusive, size)Text設定指定字元範圍的字型大小。
setFontSize(size)Text設定字型大小。
setForegroundColor(startOffset, endOffsetInclusive, color)Text設定指定字元範圍的前景顏色。
setForegroundColor(color)Text設定前景顏色。
setItalic(italic)Text設定斜體設定。
setItalic(startOffset, endOffsetInclusive, italic)Text設定指定字元範圍的斜體設定。
setLinkUrl(startOffset, endOffsetInclusive, url)Text為指定的字元範圍設定連結網址,
setLinkUrl(url)Text設定連結網址。
setStrikethrough(strikethrough)Text設定刪除線設定。
setStrikethrough(startOffset, endOffsetInclusive, strikethrough)Text為指定的字元範圍設定刪除線設定。
setText(text)Text設定文字內容。
setTextAlignment(startOffset, endOffsetInclusive, textAlignment)Text設定指定字元範圍的文字對齊方式。
setTextAlignment(textAlignment)Text設定文字對齊方式。
setUnderline(underline)Text設定底線設定。
setUnderline(startOffset, endOffsetInclusive, underline)Text設定指定字元範圍的底線設定。

TextAlignment

屬性

屬性類型說明
NORMALEnum一般文字對齊方式。
SUPERSCRIPTEnum上標文字對齊方式。
SUBSCRIPTEnum下標文字對齊方式。

UnsupportedElement

方法

方法傳回類型簡短說明
copy()UnsupportedElement傳回目前元素的卸離的深度副本。
getAttributes()Object擷取元素的屬性。
getNextSibling()Element擷取元素的下一個同層級元素。
getParent()ContainerElement擷取元素的父項元素。
getPreviousSibling()Element擷取元素先前的同層級元素。
getType()ElementType擷取元素的 ElementType
isAtDocumentEnd()Boolean判斷元素是否位於 Document 的結尾。
merge()UnsupportedElement將元素與下一個同類型的同層級合併。
removeFromParent()UnsupportedElement從父項元素中移除元素。
setAttributes(attributes)UnsupportedElement設定元素的屬性。

VerticalAlignment

屬性

屬性類型說明
BOTTOMEnum靠下對齊選項。
CENTEREnum置中對齊選項。
TOPEnum向上對齊選項。