如果需要在刚加载就显示隔行变色效果,可以采用条件格式的方式添加,
代码如下:
- window.onload = function () {
- var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 2 });
- initSpread(spread);
- };
- function initSpread(spread) {
- var style = new GC.Spread.Sheets.Style();
- style.backColor = "red";
- var ranges = [new GC.Spread.Sheets.Range(-1, -1, -1, -1)];
- var activeSheet = spread.getActiveSheet();
- activeSheet.conditionalFormats.addFormulaRule("=MOD(ROW(),2)=0", style, ranges);
- }
复制代码 |