fpspreadsheet: Fix writing formulas with "forbidden characters" in the sheet name ('<', '>', '=').

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8946 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-10-09 23:18:59 +00:00
parent e2ac13878a
commit f54a1641df

View File

@ -1269,17 +1269,20 @@ end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Determines whether a worksheet name must to be quoted. This is needed when Determines whether a worksheet name must to be quoted. This is needed when
the name begins with a numeral or a period, or when the name contains a space the name begins with a numeral or a period, or when the name contains a space
character. character. Also required if the name contains '<' or '>'.
@param ASheet Name of the worksheet to be analyzed @param ASheet Name of the worksheet to be analyzed
@returns @TRUE when the sheet name must be quoted, @FALSE otherwise @returns @TRUE when the sheet name must be quoted, @FALSE otherwise
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function SheetNameNeedsQuotes(ASheet: String): Boolean; function SheetNameNeedsQuotes(ASheet: String): Boolean;
var
i: Integer;
begin begin
if ASheet <> '' then begin if ASheet <> '' then begin
Result := true; Result := true;
if (ASheet[1] in ['0'..'9', '.']) then exit; if (ASheet[1] in ['0'..'9', '.']) then exit;
if (pos(' ', ASheet) > 0) then exit; for i := 1 to Length(ASheet) do
if (ASheet[i] in [' ', '<', '>', '=']) then exit;
end; end;
Result := false; Result := false;
end; end;