发送反馈
Document Service
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
文档
此服务允许脚本创建、访问和修改 Google 文档文件。
// Open a document by ID .
var doc = DocumentApp . openById ( 'DOCUMENT_ID' );
// Create and open a document .
doc = DocumentApp . create ( 'Document Name' );
类
属性
属性 类型 说明
BACKGROUND_COLOR
Enum
元素(段落、表格等)或文档的背景颜色。
BOLD
Enum
富文本的字体粗细设置。
BORDER_COLOR
Enum
表格元素的边框颜色。
BORDER_WIDTH
Enum
表格元素的边框宽度(以点数为单位)。
CODE
Enum
等式元素的代码内容。
FONT_FAMILY
Enum
适用于富文本的字体系列设置。
FONT_SIZE
Enum
富文本的字体大小设置(以点为单位)。
FOREGROUND_COLOR
Enum
富文本的前景颜色设置。
HEADING
Enum
段落元素的标题类型(例如 Document App.ParagraphHeading.HEADING1
)。
HEIGHT
Enum
图片元素的高度设置。
HORIZONTAL_ALIGNMENT
Enum
段落元素(例如 Document App.HorizontalAlignment.CENTER
)的水平对齐方式。
INDENT_END
Enum
段落元素的末尾缩进设置(以点为单位)。
INDENT_FIRST_LINE
Enum
段落元素的第一行缩进设置(以点为单位)。
INDENT_START
Enum
段落元素的起始缩进设置(以点为单位)。
ITALIC
Enum
富文本的字体样式设置。
GLYPH_TYPE
Enum
用于列表项元素的字形类型。
LEFT_TO_RIGHT
Enum
富文本的文本方向设置。
LINE_SPACING
Enum
行间距设置(作为乘数),适用于段落元素。
LINK_URL
Enum
链接网址(适用于富文本)。
LIST_ID
Enum
包含列表项元素的列表的 ID。
MARGIN_BOTTOM
Enum
段落元素的下边距设置(以点为单位)。
MARGIN_LEFT
Enum
段落元素的左边距设置(以磅为单位)。
MARGIN_RIGHT
Enum
段落元素的右边距设置(以点为单位)。
MARGIN_TOP
Enum
段落元素的上边距设置(以点为单位)。
NESTING_LEVEL
Enum
列表项元素的项嵌套级别。
MINIMUM_HEIGHT
Enum
表格行元素的最小高度设置(以点为单位)。
PADDING_BOTTOM
Enum
表格单元格元素的底部内边距设置(以点为单位)。
PADDING_LEFT
Enum
表格单元格元素的左内边距设置(以点为单位)。
PADDING_RIGHT
Enum
表格单元格元素的右内边距设置(以点为单位)。
PADDING_TOP
Enum
表格单元格元素的顶部内边距设置(以点为单位)。
PAGE_HEIGHT
Enum
文档的页面高度设置(以点为单位)。
PAGE_WIDTH
Enum
文档的页面宽度设置(以磅为单位)。
SPACING_AFTER
Enum
段落元素的底部间距设置(以点为单位)。
SPACING_BEFORE
Enum
段落元素的上间距设置(以点为单位)。
STRIKETHROUGH
Enum
用于富文本的删除线设置。
UNDERLINE
Enum
下划线设置,适用于富文本。
VERTICAL_ALIGNMENT
Enum
表格单元格元素的垂直对齐设置。
WIDTH
Enum
表格单元格和图片元素的宽度设置。
方法
方法 返回类型 简介
append Horizontal Rule()
Horizontal Rule
创建并附加新的 Horizontal Rule
。
append Image(image)
Inline Image
从指定的图片 blob 创建并附加新的 Inline Image
。
append Image(image)
Inline Image
附加给定的 Inline Image
。
append List Item(listItem)
List Item
附加给定的 List Item
。
append List Item(text)
List Item
创建并附加包含指定文本内容的新 List Item
。
append Page Break()
Page Break
创建并附加新的 Page Break
。
append Page Break(pageBreak)
Page Break
附加给定的 Page Break
。
append Paragraph(paragraph)
Paragraph
附加给定的 Paragraph
。
append Paragraph(text)
Paragraph
创建并附加包含指定文本内容的新 Paragraph
。
append Table()
Table
创建并附加新的 Table
。
append Table(cells)
Table
为每个指定的字符串值附加一个包含 Table Cell
的新 Table
。
append Table(table)
Table
附加给定的 Table
。
clear()
Body
清除元素的内容。
copy()
Body
返回当前元素的脱离式深层副本。
edit As Text()
Text
获取当前元素的 Text
版本,以供修改。
find Element(elementType)
Range Element
在元素的内容中搜索指定类型的后代。
find Element(elementType, from)
Range Element
从指定的 Range Element
开始,在元素的内容中搜索指定类型的后代。
find Text(searchPattern)
Range Element
使用正则表达式在元素内容中搜索指定的文本模式。
find Text(searchPattern, from)
Range Element
从给定搜索结果开始,在元素内容中搜索指定的文本模式。
get Attributes()
Object
检索元素的属性。
get Child(childIndex)
Element
检索指定子索引位置的子元素。
get Child Index(child)
Integer
检索指定子元素的子元素索引。
get Heading Attributes(paragraphHeading)
Object
检索所提供 Paragraph Heading
的一组属性。
get Images()
Inline Image[]
检索该部分中包含的所有 Inline Images
。
get List Items()
List Item[]
检索该部分中包含的所有 List Items
。
get Margin Bottom()
Number
检索下边距(以点为单位)。
get Margin Left()
Number
检索左边距(以点为单位)。
get Margin Right()
Number
检索右外边距。
get Margin Top()
Number
检索上外边距。
get Num Children()
Integer
检索子项的数量。
get Page Height()
Number
检索页面高度(以点为单位)。
get Page Width()
Number
检索页面宽度(以点为单位)。
get Paragraphs()
Paragraph[]
检索该部分中包含的所有 Paragraphs
(包括 List Items
)。
get Parent()
Container Element
检索元素的父元素。
get Tables()
Table[]
检索该部分中包含的所有 Tables
。
get Text()
String
以文本字符串的形式检索元素的内容。
get Text Alignment()
Text Alignment
获取文本对齐方式。
get Type()
Element Type
检索元素的 Element Type
。
insert Horizontal Rule(childIndex)
Horizontal Rule
在指定索引处创建并插入新的 Horizontal Rule
。
insert Image(childIndex, image)
Inline Image
在指定位置从指定图片 blob 创建并插入 Inline Image
。
insert Image(childIndex, image)
Inline Image
在指定的索引处插入给定的 Inline Image
。
insert List Item(childIndex, listItem)
List Item
在指定的索引处插入给定的 List Item
。
insert List Item(childIndex, text)
List Item
在指定索引处创建并插入包含指定文本内容的新 List Item
。
insert Page Break(childIndex)
Page Break
在指定索引处创建并插入新的 Page Break
。
insert Page Break(childIndex, pageBreak)
Page Break
在指定的索引处插入给定的 Page Break
。
insert Paragraph(childIndex, paragraph)
Paragraph
在指定的索引处插入给定的 Paragraph
。
insert Paragraph(childIndex, text)
Paragraph
在指定索引处创建并插入包含指定文本内容的新 Paragraph
。
insert Table(childIndex)
Table
在指定索引处创建并插入新的 Table
。
insert Table(childIndex, cells)
Table
在指定索引处创建并插入包含指定单元格的新 Table
。
insert Table(childIndex, table)
Table
在指定的索引处插入给定的 Table
。
remove Child(child)
Body
移除指定的子元素。
replace Text(searchPattern, replacement)
Element
使用正则表达式将给定文本模式的所有出现替换为给定的替换字符串。
set Attributes(attributes)
Body
设置元素的属性。
set Heading Attributes(paragraphHeading, attributes)
Body
为所提供的 Paragraph Heading
设置属性。
set Margin Bottom(marginBottom)
Body
设置下边距(以点为单位)。
set Margin Left(marginLeft)
Body
设置左边距(以点为单位)。
set Margin Right(marginRight)
Body
设置右外边距(以点为单位)。
set Margin Top(marginTop)
Body
设置上边距。
set Page Height(pageHeight)
Body
设置页面高度(以点为单位)。
set Page Width(pageWidth)
Body
设置页面宽度(以点为单位)。
set Text(text)
Body
将内容设置为纯文本。
set Text Alignment(textAlignment)
Body
设置文本对齐方式。
方法
方法 返回类型 简介
append Horizontal Rule()
Horizontal Rule
创建并附加新的 Horizontal Rule
。
append Image(image)
Inline Image
从指定的图片 blob 创建并附加新的 Inline Image
。
append Image(image)
Inline Image
附加给定的 Inline Image
。
append List Item(listItem)
List Item
附加给定的 List Item
。
append List Item(text)
List Item
创建并附加包含指定文本内容的新 List Item
。
append Paragraph(paragraph)
Paragraph
附加给定的 Paragraph
。
append Paragraph(text)
Paragraph
创建并附加包含指定文本内容的新 Paragraph
。
append Table()
Table
创建并附加新的 Table
。
append Table(cells)
Table
为每个指定的字符串值附加一个包含 Table Cell
的新 Table
。
append Table(table)
Table
附加给定的 Table
。
clear()
Footer Section
清除元素的内容。
copy()
Footer Section
返回当前元素的脱离式深层副本。
edit As Text()
Text
获取当前元素的 Text
版本,以供修改。
find Element(elementType)
Range Element
在元素的内容中搜索指定类型的后代。
find Element(elementType, from)
Range Element
从指定的 Range Element
开始,在元素的内容中搜索指定类型的后代。
find Text(searchPattern)
Range Element
使用正则表达式在元素内容中搜索指定的文本模式。
find Text(searchPattern, from)
Range Element
从给定搜索结果开始,在元素内容中搜索指定的文本模式。
get Attributes()
Object
检索元素的属性。
get Child(childIndex)
Element
检索指定子索引位置的子元素。
get Child Index(child)
Integer
检索指定子元素的子元素索引。
get Images()
Inline Image[]
检索该部分中包含的所有 Inline Images
。
get List Items()
List Item[]
检索该部分中包含的所有 List Items
。
get Num Children()
Integer
检索子项的数量。
get Paragraphs()
Paragraph[]
检索该部分中包含的所有 Paragraphs
(包括 List Items
)。
get Parent()
Container Element
检索元素的父元素。
get Tables()
Table[]
检索该部分中包含的所有 Tables
。
get Text()
String
以文本字符串的形式检索元素的内容。
get Text Alignment()
Text Alignment
获取文本对齐方式。
get Type()
Element Type
检索元素的 Element Type
。
insert Horizontal Rule(childIndex)
Horizontal Rule
在指定索引处创建并插入新的 Horizontal Rule
。
insert Image(childIndex, image)
Inline Image
在指定位置从指定图片 blob 创建并插入 Inline Image
。
insert Image(childIndex, image)
Inline Image
在指定的索引处插入给定的 Inline Image
。
insert List Item(childIndex, listItem)
List Item
在指定的索引处插入给定的 List Item
。
insert List Item(childIndex, text)
List Item
在指定索引处创建并插入包含指定文本内容的新 List Item
。
insert Paragraph(childIndex, paragraph)
Paragraph
在指定的索引处插入给定的 Paragraph
。
insert Paragraph(childIndex, text)
Paragraph
在指定索引处创建并插入包含指定文本内容的新 Paragraph
。
insert Table(childIndex)
Table
在指定索引处创建并插入新的 Table
。
insert Table(childIndex, cells)
Table
在指定索引处创建并插入包含指定单元格的新 Table
。
insert Table(childIndex, table)
Table
在指定的索引处插入给定的 Table
。
remove Child(child)
Footer Section
移除指定的子元素。
remove From Parent()
Footer Section
从其父元素中移除元素。
replace Text(searchPattern, replacement)
Element
使用正则表达式将给定文本模式的所有出现替换为给定的替换字符串。
set Attributes(attributes)
Footer Section
设置元素的属性。
set Text(text)
Footer Section
将内容设置为纯文本。
set Text Alignment(textAlignment)
Footer Section
设置文本对齐方式。
属性
属性 类型 说明
BULLET
Enum
默认的圆形填充圆点。
HOLLOW_BULLET
Enum
空心子弹。
SQUARE_BULLET
Enum
方形项目符号。
NUMBER
Enum
基于数字的项目符号。
LATIN_UPPER
Enum
拉丁大写圆点。
LATIN_LOWER
Enum
小写拉丁文数字符号。
ROMAN_UPPER
Enum
罗马数字,大写圆点。
ROMAN_LOWER
Enum
罗马数字,小写圆点。
方法
方法 返回类型 简介
append Horizontal Rule()
Horizontal Rule
创建并附加新的 Horizontal Rule
。
append Image(image)
Inline Image
从指定的图片 blob 创建并附加新的 Inline Image
。
append Image(image)
Inline Image
附加给定的 Inline Image
。
append List Item(listItem)
List Item
附加给定的 List Item
。
append List Item(text)
List Item
创建并附加包含指定文本内容的新 List Item
。
append Paragraph(paragraph)
Paragraph
附加给定的 Paragraph
。
append Paragraph(text)
Paragraph
创建并附加包含指定文本内容的新 Paragraph
。
append Table()
Table
创建并附加新的 Table
。
append Table(cells)
Table
为每个指定的字符串值附加一个包含 Table Cell
的新 Table
。
append Table(table)
Table
附加给定的 Table
。
clear()
Header Section
清除元素的内容。
copy()
Header Section
返回当前元素的脱离式深层副本。
edit As Text()
Text
获取当前元素的 Text
版本,以供修改。
find Element(elementType)
Range Element
在元素的内容中搜索指定类型的后代。
find Element(elementType, from)
Range Element
从指定的 Range Element
开始,在元素的内容中搜索指定类型的后代。
find Text(searchPattern)
Range Element
使用正则表达式在元素内容中搜索指定的文本模式。
find Text(searchPattern, from)
Range Element
从给定搜索结果开始,在元素内容中搜索指定的文本模式。
get Attributes()
Object
检索元素的属性。
get Child(childIndex)
Element
检索指定子索引位置的子元素。
get Child Index(child)
Integer
检索指定子元素的子元素索引。
get Images()
Inline Image[]
检索该部分中包含的所有 Inline Images
。
get List Items()
List Item[]
检索该部分中包含的所有 List Items
。
get Num Children()
Integer
检索子项的数量。
get Paragraphs()
Paragraph[]
检索该部分中包含的所有 Paragraphs
(包括 List Items
)。
get Parent()
Container Element
检索元素的父元素。
get Tables()
Table[]
检索该部分中包含的所有 Tables
。
get Text()
String
以文本字符串的形式检索元素的内容。
get Text Alignment()
Text Alignment
获取文本对齐方式。
get Type()
Element Type
检索元素的 Element Type
。
insert Horizontal Rule(childIndex)
Horizontal Rule
在指定索引处创建并插入新的 Horizontal Rule
。
insert Image(childIndex, image)
Inline Image
在指定位置从指定图片 blob 创建并插入 Inline Image
。
insert Image(childIndex, image)
Inline Image
在指定的索引处插入给定的 Inline Image
。
insert List Item(childIndex, listItem)
List Item
在指定的索引处插入给定的 List Item
。
insert List Item(childIndex, text)
List Item
在指定索引处创建并插入包含指定文本内容的新 List Item
。
insert Paragraph(childIndex, paragraph)
Paragraph
在指定的索引处插入给定的 Paragraph
。
insert Paragraph(childIndex, text)
Paragraph
在指定索引处创建并插入包含指定文本内容的新 Paragraph
。
insert Table(childIndex)
Table
在指定索引处创建并插入新的 Table
。
insert Table(childIndex, cells)
Table
在指定索引处创建并插入包含指定单元格的新 Table
。
insert Table(childIndex, table)
Table
在指定的索引处插入给定的 Table
。
remove Child(child)
Header Section
移除指定的子元素。
remove From Parent()
Header Section
从其父元素中移除元素。
replace Text(searchPattern, replacement)
Element
使用正则表达式将给定文本模式的所有出现替换为给定的替换字符串。
set Attributes(attributes)
Header Section
设置元素的属性。
set Text(text)
Header Section
将内容设置为纯文本。
set Text Alignment(textAlignment)
Header Section
设置文本对齐方式。
属性
属性 类型 说明
LEFT
Enum
“左对齐”选项。
CENTER
Enum
居中对齐选项。
RIGHT
Enum
右对齐选项。
JUSTIFY
Enum
justify-alignment 选项。
属性
属性 类型 说明
NORMAL
Enum
适用于普通文本的标题选项。
HEADING1
Enum
最高级别的标题选项。
HEADING2
Enum
第二个标题选项。
HEADING3
Enum
第三个标题选项
HEADING4
Enum
第四个标题选项。
HEADING5
Enum
第五个标题选项。
HEADING6
Enum
最低的标题选项。
TITLE
Enum
标题标题选项。
SUBTITLE
Enum
字幕标题选项。
属性
属性 类型 说明
ABOVE_TEXT
Enum
图片位于文字上方。
BREAK_BOTH
Enum
图片会将文本分隔到左侧和右侧。
BREAK_LEFT
Enum
图片会破坏左侧的文字。
BREAK_RIGHT
Enum
图片会破坏右侧的文本。
WRAP_TEXT
Enum
图片被文本换行。
方法
方法 返回类型 简介
append Horizontal Rule()
Horizontal Rule
创建并附加新的 Horizontal Rule
。
append Image(image)
Inline Image
从指定的图片 blob 创建并附加新的 Inline Image
。
append Image(image)
Inline Image
附加给定的 Inline Image
。
append List Item(listItem)
List Item
附加给定的 List Item
。
append List Item(text)
List Item
创建并附加新的 List Item
。
append Paragraph(paragraph)
Paragraph
附加给定的 Paragraph
。
append Paragraph(text)
Paragraph
创建并附加新的 Paragraph
。
append Table()
Table
创建并附加新的 Table
。
append Table(cells)
Table
附加一个包含指定单元格的新 Table
。
append Table(table)
Table
附加给定的 Table
。
clear()
Table Cell
清除元素的内容。
copy()
Table Cell
返回当前元素的脱离式深层副本。
edit As Text()
Text
获取当前元素的 Text
版本,以供修改。
find Element(elementType)
Range Element
在元素的内容中搜索指定类型的后代。
find Element(elementType, from)
Range Element
从指定的 Range Element
开始,在元素的内容中搜索指定类型的后代。
find Text(searchPattern)
Range Element
使用正则表达式在元素内容中搜索指定的文本模式。
find Text(searchPattern, from)
Range Element
从给定搜索结果开始,在元素内容中搜索指定的文本模式。
get Attributes()
Object
检索元素的属性。
get Background Color()
String
检索背景颜色。
get Child(childIndex)
Element
检索指定子索引位置的子元素。
get Child Index(child)
Integer
检索指定子元素的子元素索引。
get Col Span()
Integer
检索列跨度,即此单元格跨越的表格单元格的列数。
get Link Url()
String
检索链接网址。
get Next Sibling()
Element
检索元素的下一个同级元素。
get Num Children()
Integer
检索子项的数量。
get Padding Bottom()
Number
检索底部内边距(以点为单位)。
get Padding Left()
Number
检索左内边距(以点为单位)。
get Padding Right()
Number
检索右内边距(以点为单位)。
get Padding Top()
Number
检索顶部内边距(以点为单位)。
get Parent()
Container Element
检索元素的父元素。
get Parent Row()
Table Row
检索包含当前 Table Cell
的 Table Row
。
get Parent Table()
Table
检索包含当前 Table Cell
的 Table
。
get Previous Sibling()
Element
检索元素的上一个同级元素。
get Row Span()
Integer
检索行跨度,即此单元格跨越的表格单元格的行数。
get Text()
String
以文本字符串的形式检索元素的内容。
get Text Alignment()
Text Alignment
获取文本对齐方式。
get Type()
Element Type
检索元素的 Element Type
。
get Vertical Alignment()
Vertical Alignment
检索 Vertical Alignment
。
get Width()
Number
检索包含单元格的列的宽度(以点为单位)。
insert Horizontal Rule(childIndex)
Horizontal Rule
在指定索引处创建并插入新的 Horizontal Rule
。
insert Image(childIndex, image)
Inline Image
在指定位置从指定图片 blob 创建并插入 Inline Image
。
insert Image(childIndex, image)
Inline Image
在指定的索引处插入给定的 Inline Image
。
insert List Item(childIndex, listItem)
List Item
在指定的索引处插入给定的 List Item
。
insert List Item(childIndex, text)
List Item
在指定索引处创建并插入新的 List Item
。
insert Paragraph(childIndex, paragraph)
Paragraph
在指定的索引处插入给定的 Paragraph
。
insert Paragraph(childIndex, text)
Paragraph
在指定索引处创建并插入新的 Paragraph
。
insert Table(childIndex)
Table
在指定索引处创建并插入新的 Table
。
insert Table(childIndex, cells)
Table
在指定索引处创建并插入包含指定单元格的新 Table
。
insert Table(childIndex, table)
Table
在指定的索引处插入给定的 Table
。
is At Document End()
Boolean
确定元素是否位于 Document
的末尾。
merge()
Table Cell
将元素与同一类型的上一个同级元素合并。
remove Child(child)
Table Cell
移除指定的子元素。
remove From Parent()
Table Cell
从其父元素中移除元素。
replace Text(searchPattern, replacement)
Element
使用正则表达式将给定文本模式的所有出现替换为给定的替换字符串。
set Attributes(attributes)
Table Cell
设置元素的属性。
set Background Color(color)
Table Cell
设置背景颜色。
set Link Url(url)
Table Cell
设置链接网址。
set Padding Bottom(paddingBottom)
Table Cell
设置底部内边距(以点为单位)。
set Padding Left(paddingLeft)
Table Cell
设置左侧内边距(以点为单位)。
set Padding Right(paddingRight)
Table Cell
设置右内边距(以点为单位)。
set Padding Top(paddingTop)
Table Cell
设置上内边距(以点为单位)。
set Text(text)
Table Cell
将内容设置为纯文本。
set Text Alignment(textAlignment)
Table Cell
设置文本对齐方式。
set Vertical Alignment(alignment)
Table Cell
设置垂直对齐方式。
set Width(width)
Table Cell
设置包含当前单元格的列的宽度(以点为单位)。
方法
方法 返回类型 简介
append Text(text)
Text
将指定文本添加到此文本区域的末尾。
copy()
Text
返回当前元素的脱离式深层副本。
delete Text(startOffset, endOffsetInclusive)
Text
删除一段文本。
edit As Text()
Text
获取当前元素的 Text
版本,以供修改。
find Text(searchPattern)
Range Element
使用正则表达式在元素内容中搜索指定的文本模式。
find Text(searchPattern, from)
Range Element
从给定搜索结果开始,在元素内容中搜索指定的文本模式。
get Attributes()
Object
检索元素的属性。
get Attributes(offset)
Object
检索指定字符偏移处的属性。
get Background Color()
String
检索背景颜色设置。
get Background Color(offset)
String
检索指定字符偏移处的背景颜色。
get Font Family()
String
检索字体系列设置。
get Font Family(offset)
String
检索指定字符偏移处的字体系列。
get Font Size()
Number
检索字体大小设置。
get Font Size(offset)
Number
检索指定字符偏移处的字体大小。
get Foreground Color()
String
检索前景颜色设置。
get Foreground Color(offset)
String
检索指定字符偏移处的前景色。
get Link Url()
String
检索链接网址。
get Link Url(offset)
String
检索指定字符偏移处的链接网址。
get Next Sibling()
Element
检索元素的下一个同级元素。
get Parent()
Container Element
检索元素的父元素。
get Previous Sibling()
Element
检索元素的上一个同级元素。
get Text()
String
以文本字符串的形式检索元素的内容。
get Text Alignment()
Text Alignment
获取文本对齐方式。
get Text Alignment(offset)
Text Alignment
获取单个字符的文本对齐方式。
get Text Attribute Indices()
Integer[]
检索与不同的文本格式化运行的开始部分对应的文本索引集。
get Type()
Element Type
检索元素的 Element Type
。
insert Text(offset, text)
Text
在指定的字符偏移量处插入指定文本。
is At Document End()
Boolean
确定元素是否位于 Document
的末尾。
is Bold()
Boolean
检索粗体设置。
is Bold(offset)
Boolean
检索指定字符偏移处的粗体设置。
is Italic()
Boolean
检索斜体设置。
is Italic(offset)
Boolean
检索指定字符偏移处的斜体设置。
is Strikethrough()
Boolean
检索删除线设置。
is Strikethrough(offset)
Boolean
检索指定字符偏移处的删除线设置。
is Underline()
Boolean
检索下划线设置。
is Underline(offset)
Boolean
检索指定字符偏移处的下划线设置。
merge()
Text
将元素与同一类型的上一个同级元素合并。
remove From Parent()
Text
从其父元素中移除元素。
replace Text(searchPattern, replacement)
Element
使用正则表达式将给定文本模式的所有出现替换为给定的替换字符串。
set Attributes(startOffset, endOffsetInclusive, attributes)
Text
将指定的属性应用于给定的字符范围。
set Attributes(attributes)
Text
设置元素的属性。
set Background Color(startOffset, endOffsetInclusive, color)
Text
设置指定字符范围的背景颜色。
set Background Color(color)
Text
设置背景颜色。
set Bold(bold)
Text
设置粗体设置。
set Bold(startOffset, endOffsetInclusive, bold)
Text
为指定的字符范围设置粗体设置。
set Font Family(startOffset, endOffsetInclusive, fontFamilyName)
Text
为指定的字符范围设置字体系列。
set Font Family(fontFamilyName)
Text
设置字体系列。
set Font Size(startOffset, endOffsetInclusive, size)
Text
设置指定字符范围的字体大小。
set Font Size(size)
Text
设置字体大小。
set Foreground Color(startOffset, endOffsetInclusive, color)
Text
设置指定字符范围的前景颜色。
set Foreground Color(color)
Text
设置前景颜色。
set Italic(italic)
Text
设置斜体设置。
set Italic(startOffset, endOffsetInclusive, italic)
Text
为指定的字符范围设置斜体设置。
set Link Url(startOffset, endOffsetInclusive, url)
Text
设置指定字符范围的链接网址。
set Link Url(url)
Text
设置链接网址。
set Strikethrough(strikethrough)
Text
设置删除线设置。
set Strikethrough(startOffset, endOffsetInclusive, strikethrough)
Text
为指定的字符范围设置删除线设置。
set Text(text)
Text
设置文本内容。
set Text Alignment(startOffset, endOffsetInclusive, textAlignment)
Text
为给定字符范围设置文本对齐方式。
set Text Alignment(textAlignment)
Text
设置文本对齐方式。
set Underline(underline)
Text
设置下划线设置。
set Underline(startOffset, endOffsetInclusive, underline)
Text
为指定的字符范围设置下划线设置。
属性
属性 类型 说明
NORMAL
Enum
普通文本对齐方式。
SUPERSCRIPT
Enum
上标文本对齐方式。
SUBSCRIPT
Enum
下标文本对齐方式。
属性
属性 类型 说明
BOTTOM
Enum
底部对齐选项。
CENTER
Enum
居中对齐选项。
TOP
Enum
顶部对齐选项。
发送反馈
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可 获得了许可,并且代码示例已根据 Apache 2.0 许可 获得了许可。有关详情,请参阅 Google 开发者网站政策 。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-12-04。
需要向我们提供更多信息?
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-12-04。"],[[["Google Apps Script's Document Service allows programmatic manipulation of Google Docs files, including creating, opening, and modifying documents."],["The service provides classes like `DocumentApp`, `Body`, `Paragraph`, and `Table` to interact with document elements."],["Each class has specific methods and properties to access and modify document content, like appending elements, changing text styles, and setting attributes."],["Developers can use these methods to automate tasks, generate reports, and customize documents based on specific needs."],["The content serves as a reference guide for utilizing the Document Service and its functionalities for Google Docs manipulation."]]],[]]