WPS 加载项开发 > 表格 API 参考 > PageSetup > 属性 > PageSetup.CenterHeaderPicture 属性
返回一个 Graphic 对象,该对象表示页眉中间部分的图片。用于设置图片的属性。

语法

表达式.CenterHeaderPicture

表达式   一个代表 PageSetup 对象的变量。

说明

CenterHeaderPicture 属性为只读,但并非它的所有属性都为只读。

要求“&G”为 CenterHeader 属性字符串的组成部分,以便在中间的页眉中显示图像。

示例

本示例将 C:\ 驱动器中名为“Sample.jpg”的图片添加到页眉的中间部分。本示例假定名为“Sample.jpg”的文件位于 C:\ 驱动器上。

示例代码
function InsertPicture() {

let picture = ActiveSheet.PageSetup.CentertHeaderPicture
picture.FileName = "C:\\Sample.jpg"
picture.Height = 275.25
picture.Width = 463.5
picture.Brightness = 0.36
picture.ColorType = msoPictureGrayscale
picture.Contrast = 0.39
picture.CropBottom = -14.4
picture.CropLeft = -28.8
picture.CropRight = -14.4
picture.CropTop = 21.6
										
// Enable the image to show up in the center footer.
ActiveSheet.PageSetup.CenterFooter = "&G"
										
}


请参阅