【问题标题】:angular ag-grid how to style the header角度 ag-grid 如何设置标题样式
【发布时间】:2020-05-28 00:58:17
【问题描述】:

我在我的 Angular 应用程序中使用 ag-grid 并尝试导出到 excel。我想在 excel 中设置标题行的样式。谁能帮助我如何实现这一目标?我尝试了以下方法,但似乎没有用。

   this.excelStyles = [
      {
        id: 'smallFont',
        font: {
          fontName:'Calibri',
          size: 9
        }
      },
      {
        id:'blueBackground',
        interior: {
          color: 'blue',
          pattern: 'solid'
        }
      }
    ]

defaultColDef: {
  cellClassRules: {
    smallFont: (params) => true,
    blueBackground: (params) => params.rowIndex == 0
  }
}

谢谢

【问题讨论】:

    标签: ag-grid-angular


    【解决方案1】:

    如下所示设置 id 为 'header' 的 excelstyle 将为 excel 标题设置样式。

    {
      id:'header',
      interior: {
        color: '#002776',
        pattern: 'solid'
      },
      font: {
        color: '#ffffff',
        fontName: 'Calibri',
        size: 9,
        bold: true
      }
    }  
    

    【讨论】:

      猜你喜欢
      • 2022-01-23
      • 1970-01-01
      • 1970-01-01
      • 2020-02-08
      • 2020-10-03
      • 2020-10-25
      • 2019-04-27
      • 2020-01-23
      • 2018-06-02
      相关资源
      最近更新 更多