fpspreadsheet: Simplify expression parser by removing conversion nodes (no type check any more). Add formula ERROR.TYPE().

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4182 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-06-07 15:33:36 +00:00
parent 5ba3407139
commit f061f22e72
3 changed files with 254 additions and 470 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1400,6 +1400,21 @@ begin
Result := ErrorResult(errWrongType);
end;
procedure fpsERRORTYPE(var Result: TsExpressionResult; const Args: TsExprParameterArray);
// ERROR.TYPE(value)
// returns the numeric representation of one of the errors in Excel.
// "value" can be one of the following Excel error values
// #NULL! #DIV/0! #VALUE! #REF! #NAME? #NUM! #N/A #GETTING_DATA
var
cell: PCell;
begin
if (Args[0].ResultType = rtError) and (ord(Args[0].ResError) <= ord(errArgError))
then
Result := IntegerResult(ord(Args[0].ResError))
else
Result := EmptyResult; //ErrorResult(errArgError);
end;
procedure fpsISBLANK(var Result: TsExpressionResult; const Args: TsExprParameterArray);
// ISBLANK( value )
// Checks for blank or null values.
@ -1683,6 +1698,7 @@ begin
// Info functions
cat := bcInfo;
//AddFunction(cat, 'CELL', '?', 'Sr', INT_EXCEL_SHEET_FUNC_CELL, @fpsCELL);
AddFunction(cat, 'ERROR.TYPE','I', '?', INT_EXCEL_SHEET_FUNC_ERRORTYPE, @fpsERRORTYPE);
AddFunction(cat, 'ISBLANK', 'B', '?', INT_EXCEL_SHEET_FUNC_ISBLANK, @fpsISBLANK);
AddFunction(cat, 'ISERR', 'B', '?', INT_EXCEL_SHEET_FUNC_ISERR, @fpsISERR);
AddFunction(cat, 'ISERROR', 'B', '?', INT_EXCEL_SHEET_FUNC_ISERROR, @fpsISERROR);

View File

@ -227,6 +227,7 @@ const
INT_EXCEL_SHEET_FUNC_ACOSH = 233; // not available in BIFF2
INT_EXCEL_SHEET_FUNC_ATANH = 234; // not available in BIFF2
INT_EXCEL_SHEET_FUNC_INFO = 244; // not available in BIFF2
INT_EXCEL_SHEET_FUNC_ERRORTYPE = 261; // not available in BIFF2
INT_EXCEL_SHEET_FUNC_AVEDEV = 269; // not available in BIFF2
INT_EXCEL_SHEET_FUNC_BETADIST = 270; // not available in BIFF2
INT_EXCEL_SHEET_FUNC_BETAINV = 272; // not available in BIFF2