Class PageBackground

页面背景

描述网页的背景

方法

方法返回类型简介
getPictureFill()PictureFill获取此背景的拉伸图片填充,如果背景填充类型不是 PageBackgroundType.PICTURE,则返回 null
getSolidFill()SolidFill获取此背景的纯色填充,如果背景填充类型不是 PageBackgroundType.SOLID,则返回 null
getType()PageBackgroundType获取相应网页背景的类型。
isVisible()Boolean背景是否可见。
setPictureFill(blobSource)void将指定图片 blob 中的图片设为网页背景。
setPictureFill(imageUrl)void将指定网址处的图片设为网页背景。
setSolidFill(color)void将纯色填充设置为指定的 Color
setSolidFill(color, alpha)void将纯色填充设置为指定的 Alpha 值和 Color
setSolidFill(red, green, blue)void将纯色填充设置为指定的 RGB 值。
setSolidFill(red, green, blue, alpha)void将纯色填充设置为指定的 Alpha 和 RGB 值。
setSolidFill(hexString)void将纯色填充设置为给定的十六进制颜色字符串。
setSolidFill(hexString, alpha)void将纯色填充设置为给定的 Alpha 和十六进制颜色字符串。
setSolidFill(color)void将纯色填充设置为指定的 ThemeColorType
setSolidFill(color, alpha)void将纯色填充设置为指定的 Alpha 值和 ThemeColorType
setTransparent()void将背景设置为透明。

详细文档

getPictureFill()

获取此背景的拉伸图片填充,如果背景填充类型不是 PageBackgroundType.PICTURE,则返回 null

返回

PictureFill

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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

getSolidFill()

获取此背景的纯色填充,如果背景填充类型不是 PageBackgroundType.SOLID,则返回 null

返回

SolidFill

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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

getType()

获取相应网页背景的类型。

返回

PageBackgroundType

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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

isVisible()

背景是否可见。

返回

Boolean

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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

setPictureFill(blobSource)

将指定图片 blob 中的图片设为网页背景。图片会拉伸以匹配页面的尺寸。

插入图片时,系统会从 BlobSource 中提取一次图片,并存储一份副本以在演示文稿中显示。图片大小必须小于 50MB,像素数不得超过 2500 万,且必须为 PNG、JPEG 或 GIF 格式。

参数

名称类型说明
blobSourceBlobSource图片数据。

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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

setPictureFill(imageUrl)

将指定网址处的图片设为网页背景。图片会拉伸至与页面尺寸相匹配的尺寸。

插入图片时,系统会从相应网址获取图片一次,并存储一份副本以在演示中显示。图片大小必须小于 50MB,像素数不得超过 2500 万,且必须为 PNG、JPEG 或 GIF 格式。

所提供的网址必须可以公开访问,且不得大于 2kB。网址本身会与图片一起保存,并通过 PictureFill.getSourceUrl() 公开。

参数

名称类型说明
imageUrlString用于下载图片的网址。

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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

setSolidFill(color)

将纯色填充设置为指定的 Color

参数

名称类型说明
colorColor

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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

setSolidFill(color, alpha)

将纯色填充设置为指定的 Alpha 值和 Color

参数

名称类型说明
colorColor
alphaNumber

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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

setSolidFill(red, green, blue)

将纯色填充设置为指定的 RGB 值。

参数

名称类型说明
redInteger
greenInteger
blueInteger

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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

setSolidFill(red, green, blue, alpha)

将纯色填充设置为指定的 Alpha 和 RGB 值。

参数

名称类型说明
redInteger
greenInteger
blueInteger
alphaNumber

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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

setSolidFill(hexString)

将纯色填充设置为给定的十六进制颜色字符串。

十六进制字符串必须采用“#RRGGBB”格式。例如,粉色表示为“#FFC0CB”。

参数

名称类型说明
hexStringString

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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

setSolidFill(hexString, alpha)

将纯色填充设置为给定的 Alpha 和十六进制颜色字符串。

十六进制字符串必须采用“#RRGGBB”格式。例如,粉色表示为“#FFC0CB”。

参数

名称类型说明
hexStringString
alphaNumber

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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

setSolidFill(color)

将纯色填充设置为指定的 ThemeColorType

参数

名称类型说明
colorThemeColorType

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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

setSolidFill(color, alpha)

将纯色填充设置为指定的 Alpha 值和 ThemeColorType

参数

名称类型说明
colorThemeColorType
alphaNumber

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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

setTransparent()

将背景设置为透明。

授权

使用此方法的脚本需要获得以下一项或多项范围的授权:

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