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

NPOI corrupts a workbook with a simple calculation #1359

Closed valosharp closed 2 months ago

valosharp commented 2 months ago

NPOI Version

2.7.0

File Type

Upload the Excel File

Funding Calc bad.xlsx

Reproduce Steps

Just open the attached file using XSSFWorkbook() and save it to a different file. The sample project is here https://github.com/valosharp/NPOIEvaluation

Issue Description

When I try to open the spreadsheet, Excel immediately complains with the message "We found a problem with some content in "Funding Calc output.xslx". Do you want to us to try to recover as much as we can?..." When I respond yes, it fixes the document and produces the following report:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
    <logFileName>error371440_01.xml</logFileName>
    <summary>Errors were detected in file
        'C:\Users\vzavi\source\repos\Practice\NPOIEvaluation\NPOIEvaluation\bin\Debug\net8.0\Data\Funding
        Calc output.xlsx'</summary>
    <removedRecords>
        <removedRecord>Removed Records: Formula from /xl/calcChain.xml part (Calculation properties)</removedRecord>
    </removedRecords>
    <repairedRecords>
        <repairedRecord>Repaired Records: Cell information from /xl/worksheets/sheet1.xml part</repairedRecord>
    </repairedRecords>
</recoveryLog>

The issue is not encountered if I use NPOI v. 2.6.2 or source code from master branch of https://github.com/nissl-lab/npoi

tonyqus commented 2 months ago

duplicate with #1315