donnytian / Npoi.Mapper

Use this tool to import or export data with Excel file. The tool is a convention based mapper between strong typed object and Excel data via NPOI.
MIT License
589 stars 114 forks source link

DataFormatter.FormatCellValue does not support CONCAT function #136

Open alexanderameye opened 4 months ago

alexanderameye commented 4 months ago

Hello,

After upgrading from 4.1.0 to 6.2.1, for the same Excel file, I now get the following error (while it worked before)

Issue with EXCEL(row 906, col 1): System.NotImplementedException: Error evaluating cell EXCEL!B907\r\n ---> NPOI.SS.Formula.Eval.NotImplementedFunctionException: _xlfn.CONCAT\r\n at NPOI.SS.Formula.UserDefinedFunction.Evaluate(ValueEval[] args, OperationEvaluationContext ec)\r\n at NPOI.SS.Formula.OperationEvaluatorFactory.Evaluate(OperationPtg ptg, ValueEval[] args, OperationEvaluationContext ec)\r\n at NPOI.SS.Formula.WorkbookEvaluator.EvaluateFormula(OperationEvaluationContext ec, Ptg[] ptgs)\r\n at NPOI.SS.Formula.WorkbookEvaluator.EvaluateAny(IEvaluationCell srcCell, Int32 sheetIndex, Int32 rowIndex, Int32 columnIndex, EvaluationTracker tracker)\r\n --- End of inner exception stack trace ---\r\n at NPOI.SS.Formula.WorkbookEvaluator.EvaluateAny(IEvaluationCell srcCell, Int32 sheetIndex, Int32 rowIndex, Int32 columnIndex, EvaluationTracker tracker)\r\n at NPOI.SS.Formula.WorkbookEvaluator.Evaluate(IEvaluationCell srcCell)\r\n at NPOI.XSSF.UserModel.BaseXSSFFormulaEvaluator.EvaluateFormulaCellValue(ICell cell)\r\n at NPOI.SS.Formula.BaseFormulaEvaluator.EvaluateFormulaCellEnum(ICell cell)\r\n at NPOI.SS.Formula.BaseFormulaEvaluator.EvaluateFormulaCell(ICell cell)\r\n at NPOI.SS.UserModel.DataFormatter.FormatCellValue(ICell cell, IFormulaEvaluator evaluator)\r\n at Npoi.Mapper.MapHelper.TryGetCellValue(ICell cell, Type targetType, TrimSpacesType trimSpacesType, Object& value, IFormulaEvaluator evaluator)\r\n at Npoi.Mapper.Mapper.LoadRowData[T](IEnumerable1 columns, IRow row, T target, RowInfo1 rowInfo)"

Do you have any idea why the CONCAT function might no longer be supported after the upgrade?

When I look at the changes in Npoi.Mapper.MapHelper.TryGetCellValue, it now uses CellDataFormatter.FormatCellValue while it didn't before.

Would appreciate the help, thanks!

dcjxdd123 commented 4 months ago

Can you share your Excel file?

alexanderameye commented 4 months ago

Can you share your Excel file?

Hey sure, this is the Excel that produces the issue for me.

CONCAT_ISSUE.xlsx

Thanks!

dcjxdd123 commented 4 months ago

Can you share your Excel file?

Hey sure, this is the Excel that produces the issue for me.

CONCAT_ISSUE.xlsx

Thanks!

i think this is NPOI's error, i just pr https://github.com/nissl-lab/npoi/issues/1088

alexanderameye commented 4 months ago

Can you share your Excel file?

Hey sure, this is the Excel that produces the issue for me. CONCAT_ISSUE.xlsx Thanks!

i think this is NPOI's error, i just pr nissl-lab/npoi#1088

Thank you for this! Much appreciated! Is this now a matter of updating the version of NPOI that Npoi.Mapper uses?

dcjxdd123 commented 4 months ago

Can you share your Excel file?

Hey sure, this is the Excel that produces the issue for me. CONCAT_ISSUE.xlsx Thanks!

i think this is NPOI's error, i just pr nissl-lab/npoi#1088

Thank you for this! Much appreciated! Is this now a matter of updating the version of NPOI that Npoi.Mapper uses?

Yes Wait NPOI 2.7.1