您好,
在设置时,需要设置文字的背景色,可以参考以下代码:
- $(document).ready(function() {
- var spread = new GcSpread.Sheets.Spread($("#ss").get(0), {
- sheetCount: 3
- });
- var activeSheet = spread.getActiveSheet();
- activeSheet.setColumnWidth(2, 150, GcSpread.Sheets.SheetArea.viewport);
- activeSheet.setRowHeight(3, 35, GcSpread.Sheets.SheetArea.viewport);
- activeSheet.setRowHeight(4, 35, GcSpread.Sheets.SheetArea.viewport);
- activeSheet.setRowHeight(5, 35, GcSpread.Sheets.SheetArea.viewport);
- activeSheet.setRowHeight(6, 35, GcSpread.Sheets.SheetArea.viewport);
- var c1 = new GcSpread.Sheets.CheckBoxCellType();
- c1.textAlign(GcSpread.Sheets.CheckBoxTextAlign.left);
- c1.caption('Check Box');
- activeSheet.setCellType(3, 2, c1, GcSpread.Sheets.SheetArea.viewport);
- activeSheet.getCell(3, 2, GcSpread.Sheets.SheetArea.viewport)
- .foreColor("black")
- .hAlign(GcSpread.Sheets.HorizontalAlign.center)
- .vAlign(GcSpread.Sheets.VerticalAlign.center);
-
- var c2 = new GcSpread.Sheets.CheckBoxCellType();
- c2.textAlign(GcSpread.Sheets.CheckBoxTextAlign.right);
- c2.caption('Check Box');
- activeSheet.setCellType(4, 2, c2, GcSpread.Sheets.SheetArea.viewport);
- activeSheet.getCell(4, 2, GcSpread.Sheets.SheetArea.viewport)
- .foreColor("black")
- .hAlign(GcSpread.Sheets.HorizontalAlign.center)
- .vAlign(GcSpread.Sheets.VerticalAlign.center);
-
- var c3 = new GcSpread.Sheets.CheckBoxCellType();
- c3.textAlign(GcSpread.Sheets.CheckBoxTextAlign.bottom);
- c3.caption('Check Box');
- activeSheet.setCellType(5, 2, c3, GcSpread.Sheets.SheetArea.viewport);
- activeSheet.getCell(5, 2, GcSpread.Sheets.SheetArea.viewport)
- .foreColor("black")
- .hAlign(GcSpread.Sheets.HorizontalAlign.center)
- .vAlign(GcSpread.Sheets.VerticalAlign.center);
-
- var c4 = new GcSpread.Sheets.CheckBoxCellType();
- c4.textAlign(GcSpread.Sheets.CheckBoxTextAlign.top);
- c4.caption('Check Box');
- activeSheet.setCellType(6, 2, c4, GcSpread.Sheets.SheetArea.viewport);
- activeSheet.getCell(6, 2, GcSpread.Sheets.SheetArea.viewport)
- .foreColor("black")
- .hAlign(GcSpread.Sheets.HorizontalAlign.center)
- .vAlign(GcSpread.Sheets.VerticalAlign.center);
- });
- </script>
复制代码
2015-10-15_142318.jpg
(9.61 KB, 下载次数: 270)
|