fpspreadsheet: ods chart reader supports gradient styles.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9014 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-11-07 19:17:23 +00:00
parent 818083dd9f
commit b28852a155
4 changed files with 108 additions and 7 deletions

View File

@@ -165,6 +165,8 @@ function TryStrToFloatAuto(AText: String; out ANumber: Double;
function TryFractionStrToFloat(AText: String; out ANumber: Double;
out AIsMixed: Boolean; out AMaxDigits: Integer): Boolean;
function TryPercentStrToFloat(AText: String; out ANumber: Double): Boolean;
function Round(AValue: Double): Int64;
function cmToPts(AValue: Double): Double; inline;
@@ -1976,6 +1978,24 @@ begin
Result := true;
end;
{@@ ----------------------------------------------------------------------------
Converts a percent-formatted string to a decimal number.
Example: '150%' --> 1.5
-------------------------------------------------------------------------------}
function TryPercentStrToFloat(AText: String; out ANumber: Double): boolean;
var
res: Integer;
begin
Result := false;
if AText = '' then
exit;
if AText[Length(AText)] = '%' then Delete(AText, Length(AText), 1);
val(AText, ANumber, res);
Result := (res = 0);
if Result then
ANumber := ANumber * 0.01;
end;
{@@ ----------------------------------------------------------------------------
Special rounding function which avoids banker's rounding
-------------------------------------------------------------------------------}