【问题标题】:background color telerik grid to excel背景颜色telerik网格到excel
【发布时间】:2015-08-27 09:52:55
【问题描述】:

是否有可能以其他方式或至少像这样但有更多颜色选项?

这很好,可以满足我的需要,但我还需要更多颜色选项,这是代码

function excelExport(e) {

        var sheet = e.workbook.sheets[0];

        for (var rowIndex = 1; rowIndex < sheet.rows.length; rowIndex++) {
            var row = sheet.rows[rowIndex];

            for (var colIndex = 0; colIndex < (sheet.columns.length-2); colIndex++) {

                if (row.cells[colIndex].value == "Weekend-") {row.cells[colIndex].format = "[Blue];";}
                if (row.cells[colIndex].value == "Vacation Day-") { row.cells[colIndex].format = "[Yellow];"; }
                if (row.cells[colIndex].value == "Holiday-") { row.cells[colIndex].format = "[Green];"; }
                if (row.cells[colIndex].value == "Critical Task-") { row.cells[colIndex].format = "[Red];"; }

            }
        }
}

【问题讨论】:

    标签: excel telerik kendo-grid


    【解决方案1】:

    这个问题的答案很简单,我只需要替换if (row.cells[colIndex].value == "Weekend-") {row.cells[colIndex].format = "[Blue];";}

    if (row.cells[colIndex].value == "Weekend-") {row.cells[colIndex].background = "#1E90FF";}
    

    改变单元格的背景

    【讨论】:

      猜你喜欢
      • 2017-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多