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.67k stars 1.43k forks source link

Array Formula not being interpreted correctly #1249

Closed agerber85 closed 4 months ago

agerber85 commented 8 months ago

NPOI Version

2.6.2 (from NuGet)

File Type

Upload the Excel File

Please attach your original Excel File to help us reproduce the issue I'm not starting from an Excel file, but rather creating a XSSFWorkbook from scratch in my vb.net script. I've uploaded a .zip of the directory in 'repos' for my project.

Reproduce Steps

NPOI tester.zip

Run my project in VS and observe the parse error for the formula '{INDEX(A5:A13,MATCH(MAX(ABS(C5:C13)),ABS(C5:C13),0))}'

Issue Description

The formula '{INDEX(A5:A13,MATCH(MAX(ABS(C5:C13)),ABS(C5:C13),0))}' is not being parsed correctly by the method ICell.SetCellFormula.

tonyqus commented 4 months ago

You can try ISheet.SetArrayFormula.

Reference: https://github.com/cuba-platform/apache-poi/blob/master/poi/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java