Overwrite existing Excel results in problem with content
GLionD opened this issue · comments
NPOI 2.7.0
File Type XLSX
Coordinates.xlsx
Reproduce Steps:
string excelfile = @"path_to_file";
XSSFWorkbook book;
using (FileStream fs = new FileStream(excelfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
book = new XSSFWorkbook(fs);
}
using (FileStream fs = new FileStream(excelfile, FileMode.Create, FileAccess.ReadWrite))
{
book.Write(fs);
}
Console.WriteLine("Ready");
Console.Read();
Issue Description:
When opening an existing Excel file with some data and formulas, and save the file without making any changes, the file becomes corrupt. When opening the Excel file I get the following error message:
I can recover the file, but the formulas in cells D3 and E3 turned into fixed values.
Recovering returns the following message:
Hi, seems you're using shared formulas. Should be fixed in #1291
I wasn't aware of the use of shared formulas (even never heard about it;-)), I just filled the formula's down using the Excel application. But indeed, when unzipping the .xlsx file I see they are stored as referenced formulas.
Am I correct that NPOI is currently not supporting these referenced formulas, but in NPOI 2.7.1 it will be fixed?
This was a bug in 2.7.0, you can downgrade to 2.6.2 and it should be working. Will be fixed in 2.7.1