You've already forked lazarus-ccr
fpspreadsheet: Enable/disable workbook notifications and formula recalculations in WorksheetGrid.BeginUpdate/EndUpdate. See https://forum.lazarus.freepascal.org/index.php/topic,44547.msg313254.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6825 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1499,6 +1499,8 @@ end;
|
||||
procedure TsCustomWorksheetGrid.BeginUpdate;
|
||||
begin
|
||||
inc(FLockCount);
|
||||
Workbook.DisableNotifications;
|
||||
Workbook.LockFormulas;
|
||||
inherited BeginUpdate;
|
||||
end;
|
||||
|
||||
@ -3357,6 +3359,8 @@ end;
|
||||
procedure TsCustomWorksheetGrid.EndUpdate(ARefresh: Boolean = true);
|
||||
begin
|
||||
inherited EndUpdate(false);
|
||||
Workbook.UnlockFormulas;
|
||||
Workbook.EnableNotifications;
|
||||
dec(FLockCount);
|
||||
if (FLockCount = 0) and ARefresh then
|
||||
VisualChange;
|
||||
@ -6627,10 +6631,14 @@ begin
|
||||
Worksheet.WriteFormula(r, c, Copy(s, 2, Length(s)), true)
|
||||
else
|
||||
begin
|
||||
cell := Worksheet.GetCell(r, c);
|
||||
if cell = nil then cell := Worksheet.GetCell(r, c);
|
||||
if s = '' then
|
||||
Worksheet.WriteBlank(cell)
|
||||
else begin
|
||||
HTMLToRichText(Workbook, Worksheet.ReadCellFont(cell), s, plain, rtParams);
|
||||
Worksheet.WriteText(cell, plain, rtParams); // This will erase a non-formatted cell if s = ''
|
||||
end;
|
||||
end;
|
||||
end else
|
||||
if VarIsType(AValue, varDate) then
|
||||
Worksheet.WriteDateTime(r, c, VarToDateTime(AValue))
|
||||
|
Reference in New Issue
Block a user