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

Italian function 'DATA.MESE' not correctly mapped on EDATE

Zax opened this issue · comments

NPOI Version

v2.6.2

File Type

  • XLS

Upload the Excel File

EDATEBug.xls

Reproduce Steps

  1. Open excel file
  2. workbook.EvaluateAllFormulas() -> throw exception "NPOI.SS.Formula.Eval.NotImplementedFunctionException : DATA.MESE"

Issue Description

DATA.MESE is Italian translation of EDATE formula, but NPOI does not recognize it correctly.

For now, I use this workaround:

workbook.EvaluateAllFormulas();
Assert.Catch(workbook.EvaluateAllFormulas); // <- throw exception
// workaround - mapped manually
var udfs = new DefaultUDFFinder(["DATA.MESE"], [EDate.Instance]);
var udfToolpack = new AggregatingUDFFinder(udfs);
workbook.AddToolPack(udfToolpack);
workbook.EvaluateAllFormulas(); // <- work fine

I believe that excel file shouldn't contain any localized data, it's always in English and only the Excel App is localized and shows the data according to you region settings. How did you get the original file? WPS office shows the cell with formula contains unknown text, though MS Excel can parse it.

I'm also pretty sure that the non-localized formula (EDATE) is in the excel file. I also did a test in VBA with the control expression and the formula in the cell gives me "=EDATE(A1,1)".
I created the Excel sheet directly with Excel 2016 (Italian) and saved it in Excel 97-2003 (xls) format. Now I'm uploading a test project here on Github.

Here my test project:
https://github.com/Zax/EDataTest

Is this the only translated function Microsoft Excel provided? Or there are a few?