fpspreadsheet: Avoid destruction of cell in TsWorksheet.WriteText if text is empty (issue #0030049).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4627 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-04-23 13:01:15 +00:00
parent fc29551d2c
commit d25efe02f0

View File

@ -4098,6 +4098,8 @@ end;
@param ARichTextParams Array of formatting instructions for characters or @param ARichTextParams Array of formatting instructions for characters or
groups of characters (see TsRichTextParam). groups of characters (see TsRichTextParam).
@note The cell content will be set to cctEmpty if the string is empty.
@see TsRichTextParams @see TsRichTextParams
@see TsRichTextParam @see TsRichTextParam
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
@ -4119,7 +4121,6 @@ begin
if pos('file:', hyperlink.Target)=1 then if pos('file:', hyperlink.Target)=1 then
begin begin
URIToFileName(AText, AText); URIToFileName(AText, AText);
// Delete(AText, 1, Length('file:///'));
ForcePathDelims(AText); ForcePathDelims(AText);
end; end;
end; end;
@ -4128,16 +4129,11 @@ begin
if (AText = '') then if (AText = '') then
begin begin
if (fmt.UsedFormattingFields = []) and { Initially, the cell was destroyed here if AText = '' and the cell is not
(ACell^.Flags * [cfHyperlink, cfHasComment, cfMerged] = []) and formatted, has no comment, no hyperlink, no formula, and is not merged.
(ACell^.FormulaValue = '') This is not good... The calling procedure cannot be notified that
then ACell is destroyed here.
begin See issue #0030049 }
r := ACell^.Row;
c := ACell^.Col;
RemoveAndFreeCell(r, c);
ChangedCell(r, c);
end else
WriteBlank(ACell); WriteBlank(ACell);
exit; exit;
end; end;