发送反馈
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_COLOREnum元素(段落、表格等)或文档的背景颜色。
BOLDEnum富文本的字体粗细设置。
BORDER_COLOREnum表格元素的边框颜色。
BORDER_WIDTHEnum表格元素的边框宽度(以点数为单位)。
CODEEnum等式元素的代码内容。
FONT_FAMILYEnum适用于富文本的字体系列设置。
FONT_SIZEEnum富文本的字体大小设置(以点为单位)。
FOREGROUND_COLOREnum富文本的前景颜色设置。
HEADINGEnum段落元素的标题类型(例如 Document App.ParagraphHeading.HEADING1)。
HEIGHTEnum图片元素的高度设置。
HORIZONTAL_ALIGNMENTEnum段落元素(例如 Document App.HorizontalAlignment.CENTER)的水平对齐方式。
INDENT_ENDEnum段落元素的末尾缩进设置(以点为单位)。
INDENT_FIRST_LINEEnum段落元素的第一行缩进设置(以点为单位)。
INDENT_STARTEnum段落元素的起始缩进设置(以点为单位)。
ITALICEnum富文本的字体样式设置。
GLYPH_TYPEEnum用于列表项元素的字形类型。
LEFT_TO_RIGHTEnum富文本的文本方向设置。
LINE_SPACINGEnum行间距设置(作为乘数),适用于段落元素。
LINK_URLEnum链接网址(适用于富文本)。
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段落元素的上间距设置(以点为单位)。
STRIKETHROUGHEnum用于富文本的删除线设置。
UNDERLINEEnum下划线设置,适用于富文本。
VERTICAL_ALIGNMENTEnum表格单元格元素的垂直对齐设置。
WIDTHEnum表格单元格和图片元素的宽度设置。
方法
方法 返回类型 简介
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 设置文本对齐方式。
属性
属性 类型 说明
BULLETEnum默认的圆形填充圆点。
HOLLOW_BULLETEnum空心子弹。
SQUARE_BULLETEnum方形项目符号。
NUMBEREnum基于数字的项目符号。
LATIN_UPPEREnum拉丁大写圆点。
LATIN_LOWEREnum小写拉丁文数字符号。
ROMAN_UPPEREnum罗马数字,大写圆点。
ROMAN_LOWEREnum罗马数字,小写圆点。
方法
方法 返回类型 简介
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 设置文本对齐方式。
属性
属性 类型 说明
LEFTEnum“左对齐”选项。
CENTEREnum居中对齐选项。
RIGHTEnum右对齐选项。
JUSTIFYEnumjustify-alignment 选项。
属性
属性 类型 说明
NORMALEnum适用于普通文本的标题选项。
HEADING1Enum最高级别的标题选项。
HEADING2Enum第二个标题选项。
HEADING3Enum第三个标题选项
HEADING4Enum第四个标题选项。
HEADING5Enum第五个标题选项。
HEADING6Enum最低的标题选项。
TITLEEnum标题标题选项。
SUBTITLEEnum字幕标题选项。
属性
属性 类型 说明
ABOVE_TEXTEnum图片位于文字上方。
BREAK_BOTHEnum图片会将文本分隔到左侧和右侧。
BREAK_LEFTEnum图片会破坏左侧的文字。
BREAK_RIGHTEnum图片会破坏右侧的文本。
WRAP_TEXTEnum图片被文本换行。
方法
方法 返回类型 简介
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 为指定的字符范围设置下划线设置。
属性
属性 类型 说明
NORMALEnum普通文本对齐方式。
SUPERSCRIPTEnum上标文本对齐方式。
SUBSCRIPTEnum下标文本对齐方式。
属性
属性 类型 说明
BOTTOMEnum底部对齐选项。
CENTEREnum居中对齐选项。
TOPEnum顶部对齐选项。
发送反馈
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可 获得了许可,并且代码示例已根据 Apache 2.0 许可 获得了许可。有关详情,请参阅 Google 开发者网站政策 。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
需要向我们提供更多信息?
[[["易于理解","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):2025-07-26。"],[],["`DocumentApp` allows managing Google Docs through scripts, enabling the creation (`create`) and opening (`openById`) of documents. Key actions include adding elements like `HorizontalRule`, `InlineImage`, `ListItem`, `Paragraph`, and `Table` using `Body` methods such as `append` and `insert`. Other actions are: retrieving elements, attributes, managing text (setting, replacing), and controlling document layout (margins, size, alignment). The service facilitates managing bookmarks, access permissions, and user interface interactions. Enumerations define document attributes, element types, and formatting styles.\n"]]