NPOI
NPOI copied to clipboard
Cannot update file - error in a saved excel file
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>