diff --git a/components/fpspreadsheet/source/common/fpsfunc.pas b/components/fpspreadsheet/source/common/fpsfunc.pas index 514f93b76..6d0a7403d 100644 --- a/components/fpspreadsheet/source/common/fpsfunc.pas +++ b/components/fpspreadsheet/source/common/fpsfunc.pas @@ -2165,7 +2165,6 @@ begin Result := StringResult(resStr); end; - procedure fpsCOLUMN(var Result: TsExpressionResult; const Args: TsExprParameterArray); { COLUMN( [reference] ) @@ -2202,6 +2201,24 @@ begin Result.ResultType := rtHyperlink; end; +procedure fpsINDIRECT(var Result: TsExpressionResult; + const Args: TsExprParameterArray); +{ INDIRECT(string_reference, [ref_style]) + returns the reference to a cell based on its string representation + "string_reference": textual representation of a cell reference. + "ref_style": TRUE (default) ndicates that string_reference will be interpreted + as an A1-style reference. FALSE indicates that string_reference will be + interpreted as an R1C1-style reference. + + NOTE: ref_style and mixing of A1 and R1C1 notation is not supported. } +begin + Result := ErrorResult(errArgError); + if Length(Args) = 0 then + exit; + Result := Args[0]; +end; + + procedure fpsMATCH(var Result: TsExpressionResult; const Args: TsExprParameterArray); { MATCH( value, array, [match_type] @@ -2469,6 +2486,7 @@ begin AddFunction(cat, 'ADDRESS', 'S', 'IIibs',INT_EXCEL_SHEET_FUNC_ADDRESS, @fpsADDRESS); AddFunction(cat, 'COLUMN', 'I', 'r', INT_EXCEL_SHEET_FUNC_COLUMN, @fpsCOLUMN); AddFunction(cat, 'HYPERLINK', 'S', 'Ss', INT_EXCEL_SHEET_FUNC_HYPERLINK, @fpsHYPERLINK); + AddFunction(cat, 'INDIRECT', 'C', 'Sb', INT_EXCEL_SHEET_FUNC_INDIRECT, @fpsINDIRECT); AddFunction(cat, 'MATCH', 'I', 'SRi', INT_EXCEL_SHEET_FUNC_MATCH, @fpsMATCH); AddFunction(cat, 'ROW', 'I', 'r', INT_EXCEL_SHEET_FUNC_ROW, @fpsROW); diff --git a/components/fpspreadsheet/source/common/xlsconst.pas b/components/fpspreadsheet/source/common/xlsconst.pas index 3c7c2ca1a..2ba94ca8c 100644 --- a/components/fpspreadsheet/source/common/xlsconst.pas +++ b/components/fpspreadsheet/source/common/xlsconst.pas @@ -209,6 +209,8 @@ const INT_EXCEL_SHEET_FUNC_SYD = 143; INT_EXCEL_SHEET_FUNC_DDB = 144; + INT_EXCEL_SHEET_FUNC_INDIRECT = 148; + INT_EXCEL_SHEET_FUNC_CLEAN = 162; INT_EXCEL_SHEET_FUNC_MDETERM = 163; INT_EXCEL_SHEET_FUNC_MINVERSE = 164;