FPSpreadsheet: Fix formulas with sheetnames containing a dash character (https://forum.lazarus.freepascal.org/index.php/topic,69891.0.html)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9595 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
13b9d3578d
commit
e7384d44ad
@ -2840,6 +2840,11 @@ begin
|
||||
rtCell:
|
||||
begin
|
||||
cell := ArgToCell(Args[0]);
|
||||
if cell = nil then
|
||||
begin
|
||||
Result := ErrorResult(errWrongType);
|
||||
exit;
|
||||
end;
|
||||
case cell^.ContentType of
|
||||
cctUTF8String: searchString := cell^.UTF8StringValue;
|
||||
cctNumber: numSearchValue := cell^.NumberValue;
|
||||
|
@ -1296,14 +1296,16 @@ end;
|
||||
@returns @TRUE when the sheet name must be quoted, @FALSE otherwise
|
||||
-------------------------------------------------------------------------------}
|
||||
function SheetNameNeedsQuotes(ASheet: String): Boolean;
|
||||
const
|
||||
FORMULA_CHARS = ['+', '-', '*', '/', '^'];
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if ASheet <> '' then begin
|
||||
Result := true;
|
||||
if (ASheet[1] in ['0'..'9', '.']) then exit;
|
||||
if (ASheet[1] in (['0'..'9', '.'] + FORMULA_CHARS)) then exit;
|
||||
for i := 1 to Length(ASheet) do
|
||||
if (ASheet[i] in [' ', '<', '>', '=']) then exit;
|
||||
if (ASheet[i] in ([' ', '<', '>', '='] + FORMULA_CHARS)) then exit;
|
||||
end;
|
||||
Result := false;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user