在ag-grid Excel导出中,如何将空日期时间类型设置为空单元格而不是1900.01.00 [英] In ag-grid Excel export, how to get a null datetime type to be empty cell instead of 1900.01.00
问题描述
我正在使用ag-grid,并使用其导出为卓越"功能,特征.我导出的是日期时间类型的列.我基本上是(很简短地)在此处中回答另一个用户问题.除一个小故障外,它运作良好.
I am using ag-grid and using its "export to excel" feature. I am exporting a column which is a datetime type. I am basically doing as I (very briefly) outlined in my answer here to another users question. It works well, except for one glitch.
如果AG网格单元格值为null,即单元格为空,则我希望导出的Excel工作簿中的单元格也为空.但是,当"null"为零时,返回一个单元格的值,ag-grid使用< Data ss:Type ="DateTime"></Data>
放入工作簿中的单元格,Excel将其解释为1900-01-00.
If an AG-grid cell value is null, i.e. the cell empty, I want the cell in the exported Excel workbook to also be empty. However, when the "null" value is returned for a cell, ag-grid puts in a cell in the workbook with <Data ss:Type="DateTime"></Data>
, which gets interpreted by Excel as 1900-01-00.
有什么办法解决吗?
推荐答案
将单元格格式设置为 yyyy-mm-dd ;;;
.通过格式化呈现空白的单元格将导出空白单元格.
Format the cells as yyyy-mm-dd;;;
. A cell rendered blank by formatting exports a blank cell.
这篇关于在ag-grid Excel导出中,如何将空日期时间类型设置为空单元格而不是1900.01.00的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!