Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwrite existing Excel results in problem with content #1311

Closed
GLionD opened this issue Apr 9, 2024 · 3 comments
Closed

Overwrite existing Excel results in problem with content #1311

GLionD opened this issue Apr 9, 2024 · 3 comments

Comments

@GLionD
Copy link

GLionD commented Apr 9, 2024

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:
image
I can recover the file, but the formulas in cells D3 and E3 turned into fixed values.
Recovering returns the following message:
image

@GLionD GLionD added the bug label Apr 9, 2024
@Bykiev
Copy link
Collaborator

Bykiev commented Apr 9, 2024

Hi, seems you're using shared formulas. Should be fixed in #1291

@Bykiev Bykiev added this to the NPOI 2.7.1 milestone Apr 9, 2024
@Bykiev Bykiev added the xlsx label Apr 9, 2024
@GLionD
Copy link
Author

GLionD commented Apr 9, 2024

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?

@Bykiev
Copy link
Collaborator

Bykiev commented Apr 9, 2024

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

@tonyqus tonyqus closed this as completed Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants