fpspreadsheet: Display formulas instead of empty cells in WorksheetGrid when AutoCalc is off

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6542 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-07-01 08:15:59 +00:00
parent 03d8694142
commit af5a127379
2 changed files with 13 additions and 2 deletions

View File

@@ -1384,10 +1384,16 @@ end;
to the workbook
-------------------------------------------------------------------------------}
procedure TsWorkbookSource.SetOptions(AValue: TsWorkbookOptions);
var
AutoCalcChanged: Boolean;
begin
AutoCalcChanged := (FOptions * [boAutoCalc]) <> (AValue* [boAutoCalc]);
FOptions := AValue;
if Workbook <> nil then
if Workbook <> nil then begin
Workbook.Options := FOptions;
if AutoCalcChanged and (boAutoCalc in FOptions) then
Workbook.CalcFormulas;
end;
end;
{@@ ----------------------------------------------------------------------------

View File

@@ -3912,6 +3912,9 @@ begin
cell := Worksheet.FindCell(r, c);
if cell <> nil then
begin
if HasFormula(cell) and not (boAutoCalc in Workbook.Options) then
Result := '=' + Worksheet.ReadFormula(cell)
else
if ATrim then
Result := TrimToCell(cell)
else
@@ -6221,11 +6224,13 @@ begin
begin
optns := WorkbookSource.Options;
if FAutoCalc then
Include(optns, boAutoCalc) else
Include(optns, boAutoCalc)
else
Exclude(optns, boAutoCalc);
WorkbookSource.Options := optns;
if FInternalWorkbookSource <> nil then
FInternalWorkbookSource.Options := optns;
Invalidate;
end;
end;