gpt4 book ai didi

excel - 使用 Open XML 将日期添加到 Excel

转载 作者:行者123 更新时间:2023-12-02 12:19:53 25 4
gpt4 key购买 nike

我想使用 Open XML 将日期值插入到 Excel 文件中。

这是我的代码示例。

cell.CellValue = new CellValue(value.ToString());   
cell.DataType = new EnumValue<CellValues>(CellValues.Date);

最佳答案

显然,应该省略 DataType!

我也遇到了同样的问题,但只需设置 CellValue 就可以了!

cell.CellValue = new CellValue(value.ToOADate().ToString())

关于excel - 使用 Open XML 将日期添加到 Excel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2709171/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com