NPOI icon indicating copy to clipboard operation
NPOI copied to clipboard

Cannot update file - error in a saved excel file

Open ghost opened this issue 3 years ago • 0 comments

Create empty the Microsoft xlsx file "tmp.xlsx". Use the code below:

XSSFWorkbook xssWorkbook = null;

using (var stream = new FileStream(@"C:\temp\tmp.xlsx", FileMode.Open, FileAccess.Read))
{
    xssWorkbook = new XSSFWorkbook(stream);
}

using (var stream = new FileStream(@"C:\temp\tmp2.xlsx", FileMode.Create, FileAccess.Write))
{
    xssWorkbook.Write(stream);
}

Open the "tmp2.xlsx" file - you will see the below error:

-<removedRecords>

<removedRecord>Removed records: /xl/workbook.xml</removedRecord>

ghost avatar Oct 09 '20 11:10 ghost