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

"Do you want us to try to recover as much as we can?" error message when opnening file when using 2.7.0 version #1356

Closed jducos33 closed 3 months ago

jducos33 commented 3 months ago

NPOI Version

2.7.0 (cannot reproduce this error in 2.6.2)

File Type

Upload the Excel File

a.xlsx

Reproduce Steps

using NPOI.SS.UserModel;

string path = @"C:\temp\a.xlsx";
string out_path = @"C:\temp\exemple_out.xlsx";
using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
    var workbook = WorkbookFactory.Create(fileStream);

    var outputMs = new MemoryStream();
    workbook.Write(outputMs, false);
    var result = outputMs.ToArray();

    File.WriteAllBytes(out_path, result);
}

Issue Description

When I migrated NPOI from 2.6.2 to 2.7.0, I have now this error : "We found a problem with some content in 'filename'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes.

npoi error

tonyqus commented 3 months ago

duplicate with #1315