fpspreadsheet: Construct Excel-like formula string out of an RPN formula and display it in fpsgrid demo.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3085 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-05-23 23:13:49 +00:00
parent aad3342021
commit 4271ace593
10 changed files with 902 additions and 690 deletions

View File

@ -59,6 +59,8 @@ function ParseCellColString(const AStr: string;
var AResult: Integer): Boolean;
function GetColString(AColIndex: Integer): String;
function GetCellString(ARow,ACol: Cardinal; AFlags: TsRelFlags): String;
function GetCellRangeString(ARow1, ACol1, ARow2, ACol2: Cardinal; AFlags: TsRelFlags): String;
function UTF8TextToXMLText(AText: ansistring): ansistring;
@ -459,6 +461,29 @@ begin
Result := 'too big';
end;
const
RELCHAR: Array[boolean] of String = ('$', '');
function GetCellString(ARow, ACol: Cardinal; AFlags: TsRelFlags): String;
begin
Result := Format('%s%s%s%d', [
RELCHAR[rfRelCol in AFlags], GetColString(ACol),
RELCHAR[rfRelRow in AFlags], ARow+1
]);
end;
function GetCellRangeString(ARow1, ACol1, ARow2, ACol2: Cardinal; AFlags: TsRelFlags): String;
begin
Result := Format('%s%s%s%d:%s%s%s%d', [
RELCHAR[rfRelCol in AFlags], GetColString(ACol1),
RELCHAR[rfRelRow in AFlags], ARow1 + 1,
RELCHAR[rfRelCol2 in AFlags], GetColString(ACol2),
RELCHAR[rfRelRow2 in AFlags], ARow2 + 1
]);
// Result := GetCellString(ARow1, ACol1, AFlags) + ':' + GetCellString(ARow2, ACol2, [rfRelRow2, rfRelCol2]);
end;
{In XML files some chars must be translated}
function UTF8TextToXMLText(AText: ansistring): ansistring;
var