我的excel导出并没有带给我表格的风格

时间:2017-07-06 23:00:01

标签: angularjs kendo-ui

我有一个表格,我绘制单元格我也有过滤器,我有一个样式的标题。现在,当我想导出到excel时,它没有按照我的表的风格来做,有人知道怎么做吗?

事先我感谢你的帮助!

1 个答案:

答案 0 :(得分:0)

您可以使用excelExport事件手动更改单元格的颜色。
示例:

excelExport: function(e) {
      var sheet = e.workbook.sheets[0];
      for (var rowIndex = 1; rowIndex < sheet.rows.length; rowIndex++) {
        if (rowIndex % 2 == 0) {
          var row = sheet.rows[rowIndex];
          for (var cellIndex = 0; cellIndex < row.cells.length; cellIndex ++) {
            row.cells[cellIndex].background = "#aabbcc";
          }
        }
      }