nissl-lab / npoi

a .NET library that can read/write Office formats without Microsoft Office installed. No COM+, no interop.
Apache License 2.0
5.65k stars 1.42k forks source link

npoi will inexplicably digitize some cells with formulas #1351

Closed weifan999 closed 3 months ago

weifan999 commented 3 months ago

NPOI Version

2.7.0

File Type

Upload the Excel File

fund.xlsx

Reproduce Steps

using var fs=new FileStream(@"C:\Users\DELL\Desktop\fund.xlsx", FileMode.Open,FileAccess.ReadWrite,FileShare.None); IWorkbook wb = new XSSFWorkbook(fs); var sht = wb.GetSheet("2-银行存款盘点表"); sht.GetRow(0).GetCell(11).SetCellValue(DateTime.Today.ToShortDateString()); using var fs1= new FileStream(@"C:\Users\DELL\Desktop\fund.xlsx", FileMode.Create, FileAccess.ReadWrite, FileShare.None); wb.Write(fs1); wb.Close();

Issue Description

image When I execute the above code, I just change the date of one cell,the formulas in the purple cells in the chart will disappear and the cells will be numeric.

tonyqus commented 3 months ago

Can you try 2.6.2? I guess it can be a formula regression bug #1315

Btw, is it a new project? Or you are upgrading NPOI to 2.7.0?

weifan999 commented 3 months ago

I should have upgraded the NPOI version. Can I only use version 2.6.2 now?

weifan999 commented 3 months ago

It is not a new project. I have been using it for a while. I started using 2.6.2 and later upgraded it.

tonyqus commented 3 months ago

I should have upgraded the NPOI version. Can I only use version 2.6.2 now?

Yes, if 2.6.2 works for you, you have to. The regression will be fixed in 2.7.1. But the release date is still TBD. Usually, it takes 3-4 month to release a new version since this is not a commercial project. The contributors are using their spare time to work on it.

tonyqus commented 3 months ago

duplicate with #1315