fpspreadsheet: Fix detection of two-part time format such as 'H:MM;@' in ODS files.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6597 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-08-11 20:54:50 +00:00
parent e800b44430
commit 2e8c9b626c

View File

@ -2963,6 +2963,8 @@ procedure TsSpreadOpenDocReader.ReadNumFormats(AStylesNode: TDOMNode);
nf: TsNumberFormat;
parser: TsNumFormatParser;
counter: Integer;
op: TsCompareOperation;
x: Extended;
begin
posfmt := '';
negfmt := '';
@ -3013,30 +3015,22 @@ procedure TsSpreadOpenDocReader.ReadNumFormats(AStylesNode: TDOMNode);
parser.Free;
end;
case condition[1] of
'>': begin
posfmt := fmt;
if (Length(condition) > 1) and (condition[2] = '=') then
zerofmt := fmt;
end;
'<': begin
negfmt := fmt;
if (Length(condition) > 1) and (condition[2] = '=') then
zerofmt := fmt;
end;
'=': begin
zerofmt := fmt;
end;
if TryStrToFloat(AnalyzeCompareStr(condition, op), x, FPointSeparatorSettings) then
begin
if x = 0 then
// This condition is used in currency formats
case op of
coEqual: zerofmt := fmt;
coLess, coLessEqual: negfmt := fmt;
coGreater, coGreaterEqual: posfmt := fmt;
end
else if (x > 1E308) and (op in [coLess, coLessEqual]) then
// used "in hh:mm;@"
posfmt := fmt;
end;
ANode := ANode.NextSibling;
inc(counter);
end;
{
if posfmt = '' then posfmt := currFmt;
if negfmt = '' then negfmt := currFmt;
}
// if posfmt = '' then posfmt := AFormatStr;
// if negfmt = '' then negfmt := AFormatStr;
case counter of
1: begin