unvell / ReoGrid

Fast and powerful .NET spreadsheet component, support data format, freeze, outline, formula calculation, chart, script execution and etc. Compatible with Excel 2007 (.xlsx) format and working on .NET 3.5 (or client profile), WPF and Android platform.
https://reogrid.net
MIT License
1.32k stars 390 forks source link

HEX2DEC Formula when implemented it does not work. #437

Open chandantiwari02 opened 3 years ago

chandantiwari02 commented 3 years ago

Following quick code implemented for above formula

case BuiltinFunctionNames.HEX2DEC_EN:

region HEX2DEC

                args = GetFunctionArgs(cell, funNode.Children, 1, 2);                  
                    if (args[0].type != FormulaValueType.Number)
                    {
                        throw new FormulaParameterMismatchException(cell);
                    }
                return int.Parse(args[0], System.Globalization.NumberStyles.HexNumber);

But above HEX2DEC get wrongly truncated to HEX2 for cell value , may be it is following (?\$?[A-Z]+\$?[0-9]+)

But when we change above formula name to HEXTODEC it works.

jingwood commented 3 years ago

Looks like the function name HEX2 was recognized as a cell address.

jingwood commented 1 year ago

Consider change to parse cell address from an entire word to avoid this.