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