fpspreadsheet: Fix 3d cell references with a single other sheet (Sheet1!A1:C3), except for ODS. 3d references with several sheets prepared (not tested yet). Some more unit tests.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6408 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-05-13 10:15:13 +00:00
parent 4d4e06ecb9
commit d2351b5559
12 changed files with 1624 additions and 476 deletions

View File

@@ -755,7 +755,7 @@ type
procedure PrepareBeforeReading;
procedure PrepareBeforeSaving;
procedure ReCalc;
// procedure ReCalc;
public
{@@ A copy of SysUtil's DefaultFormatSettings (converted to UTF8) to provide
@@ -8119,6 +8119,7 @@ end;
{@@ ----------------------------------------------------------------------------
Recalculates rpn formulas in all worksheets
-------------------------------------------------------------------------------}
(*
procedure TsWorkbook.Recalc;
var
sheet: pointer;
@@ -8126,6 +8127,7 @@ begin
for sheet in FWorksheets do
TsWorksheet(sheet).CalcFormulas;
end;
*)
{@@ ----------------------------------------------------------------------------
Conversion of length values between units
@@ -8475,7 +8477,8 @@ begin
ok := true;
UpdateCaches;
if (boAutoCalc in Options) then
Recalc;
CalcFormulas;
// Recalc;
FFormatID := AFormatID;
finally
FReadWriteFlag := rwfNormal;
@@ -8611,7 +8614,8 @@ begin
ok := true;
UpdateCaches;
if (boAutoCalc in Options) then
Recalc;
CalcFormulas;
// Recalc;
FFormatID := AFormatID;
finally
FReadWriteFlag := rwfNormal;
@@ -8977,11 +8981,13 @@ end;
function TsWorkbook.GetWorksheetByName(AName: String): TsWorksheet;
var
i:integer;
s: String;
begin
Result := nil;
for i:=0 to FWorksheets.Count-1 do
begin
if UTF8CompareText(TsWorkSheet(FWorkSheets.Items[i]).Name, AName) = 0 then
s := TsWorksheet(FWorksheets.Items[i]).Name;
if UTF8CompareText(s, AName) = 0 then
begin
Result := TsWorksheet(FWorksheets.Items[i]);
exit;
@@ -9012,10 +9018,15 @@ end;
worksheet does not exist.
-------------------------------------------------------------------------------}
function TsWorkbook.GetWorksheetIndex(const AWorksheetName: String): Integer;
var
s: String;
begin
for Result := 0 to FWorksheets.Count-1 do
if TsWorksheet(FWorksheets[Result]).Name = AWorksheetName then
begin
s := TsWorksheet(FWorksheets[Result]).Name;
if SameText(s, AWorksheetName) then
exit;
end;
Result := -1;
end;