简体   繁体   English

使用 getDataAsExcel 导出 AG-Grid

[英]AG-Grid export using getDataAsExcel

I am using ag grid to export the table refering to this link.我正在使用 ag grid 来导出引用链接的表。

We are able to export using exportDataAsExcel method and downloaded excel sheet is having sheet name as ag grid .我们可以使用exportDataAsExcel方法导出,下载的 excel 工作表的工作表名称为ag grid

Can we configure the sheet name to something else?我们可以将工作表名称配置为其他名称吗?

I have also tried using getDataAsExcel method which returns the result as a string rather than download it.我也尝试使用getDataAsExcel方法,该方法将结果作为字符串返回,而不是下载它。

however I am not able to download to excel sheet using getDataAsExcel .但是我无法使用getDataAsExcel下载到 excel 表。

SO basically how can we change sheet name to something else OR is there any other way to export as excel in ag-grid so than sheet name can be configured.所以基本上我们如何将工作表名称更改为其他名称,或者是否有任何其他方式可以在 ag-grid 中导出为 excel,以便可以配置工作表名称。

To reproduce we can use same example given in the ag-grid documentation .为了重现,我们可以使用ag-grid 文档中给出的相同示例。

You can set the sheet name using the exportDataAsExcel , and passing the sheetName in the params for the function.您可以使用exportDataAsExcel设置工作表名称,并在sheetNameparams中传递 sheetName。

There's a demo of setting the sheet name in the documentation here .此处的文档中有设置工作表名称的演示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM