fpspreadsheet: Don't write leading '=' to ods formulas if in ignoreformulas mode.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6220 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-03-04 09:35:40 +00:00
parent 3391d5813f
commit 72edcdf239

View File

@@ -7502,9 +7502,13 @@ begin
if FWorksheet.HasHyperlink(ACell) then if FWorksheet.HasHyperlink(ACell) then
FWorkbook.AddErrorMsg(rsODSHyperlinksOfTextCellsOnly, [GetCellString(ARow, ACol)]); FWorkbook.AddErrorMsg(rsODSHyperlinksOfTextCellsOnly, [GetCellString(ARow, ACol)]);
// Formula string
if ignoreFormulas then begin if ignoreFormulas then begin
formula := ACell^.FormulaValue; formula := ACell^.FormulaValue;
if (formula <> '') and (formula[1] = '=') then Delete(formula, 1, 1); if (formula <> '') then begin
if not ((pos('of:=', formula) = 1) or (pos('=', formula) = 1)) then
formula := 'of:=' + formula;
end;
end else end else
begin begin
valueStr := ''; valueStr := '';
@@ -7514,6 +7518,8 @@ begin
parser.Dialect := fdOpenDocument; parser.Dialect := fdOpenDocument;
parser.Expression := ACell^.FormulaValue; parser.Expression := ACell^.FormulaValue;
formula := Parser.LocalizedExpression[FPointSeparatorSettings]; formula := Parser.LocalizedExpression[FPointSeparatorSettings];
if (formula <> '') and (formula[1] <> '=') then
formula := '=' + formula;
finally finally
parser.Free; parser.Free;
end; end;
@@ -7570,7 +7576,7 @@ begin
data type. Seems to work... } data type. Seems to work... }
if not ignoreFormulas or (FWorksheet.GetCalcState(ACell) = csCalculated) then if not ignoreFormulas or (FWorksheet.GetCalcState(ACell) = csCalculated) then
AppendToStream(AStream, Format( AppendToStream(AStream, Format(
'<table:table-cell table:formula="=%s" office:value-type="%s"%s%s%s>' + '<table:table-cell table:formula="%s" office:value-type="%s"%s%s%s>' +
comment + comment +
valueStr + valueStr +
'</table:table-cell>', [ '</table:table-cell>', [
@@ -7579,7 +7585,7 @@ begin
else else
begin begin
AppendToStream(AStream, Format( AppendToStream(AStream, Format(
'<table:table-cell table:formula="=%s"%s%s', [ '<table:table-cell table:formula="%s"%s%s', [
formula, lStyle, spannedStr])); formula, lStyle, spannedStr]));
if comment <> '' then if comment <> '' then
AppendToStream(AStream, '>' + comment + '</table:table-cell>') AppendToStream(AStream, '>' + comment + '</table:table-cell>')