fpspreadsheet: Support of some more features by Excel2003/XML reader. Display PrintRanges, repeated rows and columns by SpreadsheetInspector.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7042 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-07-16 15:41:29 +00:00
parent c8f9609d28
commit b472802603
3 changed files with 335 additions and 3 deletions

View File

@@ -93,11 +93,14 @@ function GetCellRangeString(ARange: TsCellRange;
function GetCellString(ARow,ACol: Cardinal;
AFlags: TsRelFlags = [rfRelRow, rfRelCol]): String;
function GetColString(AColIndex: Integer): String;
function GetRowString(ARowIndex: Integer): String;
// -- "R1C1" syntax
function ParseCellRangeString_R1C1(const AStr: string; ABaseRow, ABaseCol: Cardinal;
out AFirstCellRow, AFirstCellCol, ALastCellRow, ALastCellCol: Cardinal;
out AFlags: TsRelFlags): Boolean;
function ParseCellString_R1C1(const AStr: String; ABaseRow, ABaseCol: Cardinal;
out ASheet: String; out ACellRow, ACellCol: Cardinal; out AFlags: TsRelFlags): Boolean; overload;
function ParseCellString_R1C1(const AStr: String; ABaseRow, ABaseCol: Cardinal;
out ACellRow, ACellCol: Cardinal; out AFlags: TsRelFlags): Boolean; overload;
function ParseCellString_R1C1(const AStr: string; ABaseRow, ABaseCol: Cardinal;
@@ -701,6 +704,22 @@ begin
if rfRelCol in f then Include(AFlags, rfRelCol2);
end;
function ParseCellString_R1C1(const AStr: String; ABaseRow, ABaseCol: Cardinal;
out ASheet: String; out ACellRow, ACellCol: Cardinal;
out AFlags: TsRelFlags): Boolean;
var
p: Integer;
begin
p := pos('!', AStr);
if p > 0 then begin
ASheet := Copy(AStr, 1, p-1);
Result := ParseCellString_R1C1(Copy(AStr, p+1, MaxInt), ABaserow, ABaseCol, ACellRow, ACellCol, AFlags);
end else begin
ASheet := '';
Result := ParseCellString_R1C1(AStr, ABaseRow, ABaseCol, ACellRow, ACellCol, AFlags);
end;
end;
{@@ ----------------------------------------------------------------------------
Parses a cell string in "R1C1" notation into zero-based column and row numbers
'AFlags' indicates relative addresses.
@@ -1078,6 +1097,17 @@ begin
end;
end;
{@@ ----------------------------------------------------------------------------
Calculates an Excel row name ('1', '2' etc) from the zero-based row index
@param ARowIndex Zero-based row index
@return Numerical, one-based row name string.
-------------------------------------------------------------------------------}
function GetRowString(ARowIndex: Integer): String;
begin
Result := IntToStr(ARowIndex+1);
end;
const
RELCHAR: Array[boolean] of String = ('$', '');