Open meygerjos opened 2 years ago
For some reason the parser recognizes lookup but not xlookup, even though xlookup is supposed to be supported.
lookup
xlookup
Code:
System.out.println("Parse \"LOOKUP(E76,$A$13:$A$41,$F$13:$F$41)\""); for (Ptg ptg : FormulaParser.parse("LOOKUP(E76,$A$13:$A$41,$F$13:$F$41)", ewb, FormulaType.CELL, wb.getSheetIndex(sheet))) { System.out.println(ptg); } System.out.println("Parse \"XLOOKUP(E76,$A$13:$A$41,$F$13:$F$41)\""); for (Ptg ptg : FormulaParser.parse("XLOOKUP(E76,$A$13:$A$41,$F$13:$F$41)", ewb, FormulaType.CELL, wb.getSheetIndex(sheet))) { System.out.println(ptg); }
Output:
Parse "LOOKUP(E76,$A$13:$A$41,$F$13:$F$41)" { /* RefPtg */ "row": 75 /* 0x0000004b */ , "rowRelative": true , "column": 4 , "colRelative": true , "formatReference": "E76" } { /* AreaPtg */ "firstRow": 12 /* 0x0000000c */ , "firstRowRelative": false , "firstColumn": 0 , "firstColRelative": false , "lastRow": 40 /* 0x00000028 */ , "lastRowRelative": false , "lastColumn": 0 , "lastColRelative": false , "formatReference": "$A$13:$A$41" } { /* AreaPtg */ "firstRow": 12 /* 0x0000000c */ , "firstRowRelative": false , "firstColumn": 5 , "firstColRelative": false , "lastRow": 40 /* 0x00000028 */ , "lastRowRelative": false , "lastColumn": 5 , "lastColRelative": false , "formatReference": "$F$13:$F$41" } { /* FuncVarPtg */ "functionIndex": 28 /* 0x001c */ , "functionName": "LOOKUP" , "numberOfOperands": 3 , "externalFunction": false , "defaultOperandClass": 32 /* 0x20 */ , "cetab": false } Parse "XLOOKUP(E76,$A$13:$A$41,$F$13:$F$41)" { /* NameXPxg */ "externalWorkbookNumber": -1 /* 0xffffffff */ , "sheetName": null , "nameName": "XLOOKUP" } { /* RefPtg */ "row": 75 /* 0x0000004b */ , "rowRelative": true , "column": 4 , "colRelative": true , "formatReference": "E76" } { /* AreaPtg */ "firstRow": 12 /* 0x0000000c */ , "firstRowRelative": false , "firstColumn": 0 , "firstColRelative": false , "lastRow": 40 /* 0x00000028 */ , "lastRowRelative": false , "lastColumn": 0 , "lastColRelative": false , "formatReference": "$A$13:$A$41" } { /* AreaPtg */ "firstRow": 12 /* 0x0000000c */ , "firstRowRelative": false , "firstColumn": 5 , "firstColRelative": false , "lastRow": 40 /* 0x00000028 */ , "lastRowRelative": false , "lastColumn": 5 , "lastColRelative": false , "formatReference": "$F$13:$F$41" } { /* FuncVarPtg */ "functionIndex": 255 /* 0x00ff */ , "functionName": "#external#" , "numberOfOperands": 4 , "externalFunction": true , "defaultOperandClass": 32 /* 0x20 */ , "cetab": false }
Just put a bug report on Apache POI: https://bz.apache.org/bugzilla/show_bug.cgi?id=66283
For some reason the parser recognizes
lookup
but notxlookup
, even thoughxlookup
is supposed to be supported.Code:
Output: