You've already forked lazarus-ccr
fpspreadsheet: Make sure that formulas are erased when new cell values are written by WorksheetGrid.Cells into cells containing formulas.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4432 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -4452,9 +4452,24 @@ begin
|
||||
end else
|
||||
fmt := nil;
|
||||
|
||||
if VarIsNull(AValue) then
|
||||
Worksheet.WriteBlank(r, c)
|
||||
else
|
||||
if VarIsNull(AValue) then begin
|
||||
cell := Worksheet.WriteBlank(r, c);
|
||||
if cell <> nil then cell^.FormulaValue := '';
|
||||
end else
|
||||
if VarIsStr(AValue) then
|
||||
begin
|
||||
s := VarToStr(AValue);
|
||||
if s[1] = '=' then
|
||||
begin
|
||||
Worksheet.WriteFormula(r, c, Copy(s, 2, Length(s)), true);
|
||||
exit;
|
||||
end;
|
||||
Worksheet.WriteCellValueAsString(r, c, s);
|
||||
cell^.FormulaValue := '';
|
||||
end else
|
||||
begin
|
||||
if cell <> nil then
|
||||
cell^.FormulaValue := '';
|
||||
if VarIsType(AValue, varDate) then
|
||||
Worksheet.WriteDateTime(r, c, VarToDateTime(AValue))
|
||||
else
|
||||
@ -4475,12 +4490,6 @@ begin
|
||||
end else
|
||||
if VarIsBool(AValue) then
|
||||
Worksheet.WriteBoolValue(r, c, AValue)
|
||||
else
|
||||
if VarIsStr(AValue) then begin
|
||||
s := VarToStr(AValue);
|
||||
if (s[1] = '=') then
|
||||
Worksheet.WriteFormula(r, c, Copy(s, 2, Length(s)), true) else
|
||||
Worksheet.WriteCellValueAsString(r, c, s);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Reference in New Issue
Block a user