【问题标题】:Why aren't my ag-grid header excelStyles working?为什么我的 ag-grid 标头 excelStyles 不起作用?
【发布时间】:2021-06-01 11:56:41
【问题描述】:

我正在尝试将我的 ag-grid 导出为 Excel 文档。我只为标题添加了 excelStyles,但它们并未应用于文档。

代码如下:

  var columnWidth = 100;
  var params = {
    columnWidth,
    sheetName: 'Types',
    suppressTextAsCDATA: false,
    rowHeight: 25,
    headerRowHeight: 25,
    allColumns: true,
    excelStyles: [
      {
        id: 'header',
        font: {
          color: '#000000',
          bold: true
        },
        interior: {
          color: '#bed4f7',
          pattern: 'Solid'
        }
      }
    ]
  }
  gridOptions.api.exportDataAsExcel(params);
}

我需要进行哪些更改才能使其正常工作?

【问题讨论】:

    标签: javascript excel grid export ag-grid


    【解决方案1】:

    对于犯同样愚蠢错误的人,您需要在 gridOptions 中定义 excelStyles,而不是参数!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-12-13
      • 2021-02-09
      • 2019-01-21
      • 2021-01-03
      • 1970-01-01
      • 1970-01-01
      • 2020-07-25
      • 1970-01-01
      相关资源
      最近更新 更多