...
颜色分为两种,前景色和背景色。前景色控制字体或内容的颜色,背景色控制背景的颜色。
您可以使用 backColor 设置背景色,使用 foreColor 设置前景色。您可以在小组件中使用 设置前景色。您可以在小组件中使用 backColor 设置背景色。 您可以使用 options.grayAreaBackColor 来设置灰色区域(内容区域的空白部分)的背景色.
如果您想了解更多关于主题的信息,请访问 Using Themes 一节。你也可以使用样式(Styles)来设置表格的外观。如果你想了解更多关于样式(Styles)的信息,请访问 Setting Styles.
参考代码
本代码为 B2 单元格设置了 单元格设置了前景色 和 和背景色:
//给单元格设置前景色和背景色
...
Code Block | ||||
---|---|---|---|---|
|
...
Copy Code
//Set the backcolor and forecolor of cells. var cell = activeSheet.getCell(1, 1, GC.Spread.Sheets.SheetArea.viewport); |
...
cell.backColor("Blue"); |
...
cell.foreColor("Red"); |
...
cell.value("Color"); |
...
示例代码
以下代码演示了如何给标题区域设置颜色
...
Code Block | ||||
---|---|---|---|---|
|
...
Copy Code
//给所有的列标题设置前景色和背景色
//Set the backcolor and forecolor for the entire column header. var row = activeSheet.getRange(0, -1, 1, -1, |
...
GC.Spread.Sheets.SheetArea.colHeader); |
...
row.backColor("Red"); |
...
row.foreColor("White"); |
...
//Set the backcolor for the second row header. activeSheet.getCell(1, 0, GC.Spread.Sheets.SheetArea.rowHeader).backColor("Yellow"); |
...
更多信息
Using Custom Themes from ThemeRoller
Object Inheritance
Setting Styles
Working with Selections
Workbook Method