nissl-lab / npoi

a .NET library that can read/write Office formats without Microsoft Office installed. No COM+, no interop.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Formula openxml gets corrupted after opened and saved by NPOI 2.7.0

Quark321 opened this issue · comments

NPOI Version

2.7.0

File Type

  • XLSX
  • XLS
  • DOCX
  • [x ] XLSM
  • OTHER

Upload the Excel File

I cannot upload file as it is my company IP

Reproduce Steps

After update to 2.7.0 from 2.6.2 the same file gives the corrupted file error after the file is opened and saved by NPOI.

error805920_01.xml Errors were detected in file 'xxxxx.xlsm' Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded. Removed Records: Formula from /xl/calcChain.xml part (Calculation properties) Repaired Records: Cell information from /xl/worksheets/sheet3.xml part

Issue Description

After downgrade to 2.6.2 it works as expected.
I was not able to indentify cells or formulas affected apart the log file I have added

Fixed in #1291

@Bykiev Why do you believe this issue is fixed by #1291? I don't see the clues.

@Quark321 Without the original Excel file, it's very hard to figure out what the issue is.

@Bykiev Why do you believe this issue is fixed by #1291? I don't see the clues.

The issue is not reproduced in 2.6.2 and the same /xl/calcChain.xml corruption occured. 100% sure it's a shared formula bug, which was fixed. I believe we should release a patch version ASAP.

@Quark321 Without the original Excel file, it's very hard to figure out what the issue is.

Hi Tony,

Unfortunately I can't share the file as macros and data are IP of the company. To be honest I am not a familiar with the OpenXML format but if you navigate me to the required xml nodes within the excel file, I can review those and share only affected fragments.

We are encountering the same issue.
We set "SUM(A1:A2)" at position A3, "SUM(B1:B2)" at position B3, and "SUM(C1:C2)" at position C3 in sheet 3, and use it as a template.
Then, we use NPOI to write data to sheet1 and sheet2, instead of sheet 3. The exported Excel file ends up having a corrupted /xl/calcChain.xml. Additionally, the formula in the C3 column of sheet 3 is lost.

Can you guys reproduce this issue with 2.6.2?

@Bykiev
This issue does not occur in 2.6.2. It only occurs in 2.7.0.

Can you please check with main branch?

I think it can be a regression bug. But I need an original Excel to help reproduce this and figure out what's changed.

template.xlsx
@tonyqus
Hi, maybe you can try this template, sheet3 have "SUM" formula.

This regression is caused by a change in #913 fix