fpspreadsheet: Erase formula if a new value is entered into cell

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4183 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-06-07 17:52:38 +00:00
parent f061f22e72
commit b8f0d3572e
2 changed files with 13 additions and 4 deletions

View File

@ -3057,12 +3057,18 @@ procedure TsEqualExprNode.GetNodeValue(out AResult: TsExpressionResult);
var var
LRes, RRes: TsExpressionResult; LRes, RRes: TsExpressionResult;
begin begin
if HasError(AResult) then
exit;
Left.GetNodeValue(LRes); Left.GetNodeValue(LRes);
Right.GetNodeValue(RRes); Right.GetNodeValue(RRes);
if Left.HasError(AResult) and Right.HasError(AResult) then
begin
AResult := BooleanResult(LRes.ResError = RRes.ResError);
exit;
end;
if HasError(AResult) then
exit;
if IsString(LRes) and IsString(RRes) then if IsString(LRes) and IsString(RRes) then
AResult := BooleanResult(ArgToString(LRes) = ArgToString(RRes)) AResult := BooleanResult(ArgToString(LRes) = ArgToString(RRes))
else else

View File

@ -3782,6 +3782,8 @@ begin
isPercent := Pos('%', AValue) = Length(AValue); isPercent := Pos('%', AValue) = Length(AValue);
if isPercent then Delete(AValue, Length(AValue), 1); if isPercent then Delete(AValue, Length(AValue), 1);
ACell^.FormulaValue := '';
if TryStrToCurrency(AValue, number, currSym, FWorkbook.FormatSettings) then if TryStrToCurrency(AValue, number, currSym, FWorkbook.FormatSettings) then
begin begin
WriteCurrency(ACell, number, nfCurrencyRed, -1, currSym); WriteCurrency(ACell, number, nfCurrencyRed, -1, currSym);
@ -4322,7 +4324,8 @@ begin
end; end;
// Store formula in cell // Store formula in cell
ACell^.ContentType := cctFormula; if AFormula <> '' then
ACell^.ContentType := cctFormula;
ACell^.FormulaValue := AFormula; ACell^.FormulaValue := AFormula;
ChangedCell(ACell^.Row, ACell^.Col); ChangedCell(ACell^.Row, ACell^.Col);
end; end;