You've already forked lazarus-ccr
fpspreadsheet: Improved syntax for mixed fraction formatting strings
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4074 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -903,21 +903,21 @@ object MainForm: TMainForm
|
|||||||
WorkbookSource = WorkbookSource
|
WorkbookSource = WorkbookSource
|
||||||
Caption = 'Fraction (1 digit)'
|
Caption = 'Fraction (1 digit)'
|
||||||
NumberFormat = nfFraction
|
NumberFormat = nfFraction
|
||||||
NumberFormatString = '#" "#/#'
|
NumberFormatString = '# #/#'
|
||||||
end
|
end
|
||||||
object AcNumFormatFraction2: TsNumberFormatAction
|
object AcNumFormatFraction2: TsNumberFormatAction
|
||||||
Category = 'FPSpreadsheet'
|
Category = 'FPSpreadsheet'
|
||||||
WorkbookSource = WorkbookSource
|
WorkbookSource = WorkbookSource
|
||||||
Caption = 'Fraction (2 digits)'
|
Caption = 'Fraction (2 digits)'
|
||||||
NumberFormat = nfFraction
|
NumberFormat = nfFraction
|
||||||
NumberFormatString = '#" "##/##'
|
NumberFormatString = '# ##/##'
|
||||||
end
|
end
|
||||||
object AcNumFormatFraction3: TsNumberFormatAction
|
object AcNumFormatFraction3: TsNumberFormatAction
|
||||||
Category = 'FPSpreadsheet'
|
Category = 'FPSpreadsheet'
|
||||||
WorkbookSource = WorkbookSource
|
WorkbookSource = WorkbookSource
|
||||||
Caption = 'Fraction (3 digits)'
|
Caption = 'Fraction (3 digits)'
|
||||||
NumberFormat = nfFraction
|
NumberFormat = nfFraction
|
||||||
NumberFormatString = '#" "###/###'
|
NumberFormatString = '# ###/###'
|
||||||
end
|
end
|
||||||
object AcNumFormatDateTime: TsNumberFormatAction
|
object AcNumFormatDateTime: TsNumberFormatAction
|
||||||
Category = 'FPSpreadsheet'
|
Category = 'FPSpreadsheet'
|
||||||
|
@ -122,13 +122,9 @@ type
|
|||||||
// Format string
|
// Format string
|
||||||
function BuildFormatString(ADialect: TsNumFormatDialect): String; virtual;
|
function BuildFormatString(ADialect: TsNumFormatDialect): String; virtual;
|
||||||
function BuildFormatStringFromSection(ASection: Integer;
|
function BuildFormatStringFromSection(ASection: Integer;
|
||||||
ADialect: TsNumFormatDialect; AStartIndex: Integer = 0): String; virtual;
|
ADialect: TsNumFormatDialect): String; virtual;
|
||||||
// NumberFormat
|
// NumberFormat
|
||||||
procedure EvalNumFormatOfSection(ASection: Integer);
|
procedure EvalNumFormatOfSection(ASection: Integer);
|
||||||
{; out ANumFormat: TsNumberFormat;
|
|
||||||
out ADecimals: byte; out ANumerator, ADenominator: Integer;
|
|
||||||
out ACurrencySymbol: String; out AColor: TsColor);
|
|
||||||
}
|
|
||||||
function IsCurrencyAt(ASection: Integer; out ANumFormat: TsNumberFormat;
|
function IsCurrencyAt(ASection: Integer; out ANumFormat: TsNumberFormat;
|
||||||
out ADecimals: byte; out ACurrencySymbol: String; out AColor: TsColor): Boolean;
|
out ADecimals: byte; out ACurrencySymbol: String; out AColor: TsColor): Boolean;
|
||||||
function IsDateAt(ASection,AIndex: Integer; out ANumberFormat: TsNumberFormat;
|
function IsDateAt(ASection,AIndex: Integer; out ANumberFormat: TsNumberFormat;
|
||||||
@ -296,7 +292,7 @@ end;
|
|||||||
{ Creates a format string for the given section. This implementation covers
|
{ Creates a format string for the given section. This implementation covers
|
||||||
the formatstring dialects of fpc (nfdDefault) and Excel (nfdExcel). }
|
the formatstring dialects of fpc (nfdDefault) and Excel (nfdExcel). }
|
||||||
function TsNumFormatParser.BuildFormatStringFromSection(ASection: Integer;
|
function TsNumFormatParser.BuildFormatStringFromSection(ASection: Integer;
|
||||||
ADialect: TsNumFormatDialect; AStartIndex: Integer = 0): String;
|
ADialect: TsNumFormatDialect): String;
|
||||||
var
|
var
|
||||||
element: TsNumFormatElement;
|
element: TsNumFormatElement;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@ -588,7 +584,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
// nfFraction
|
// nfFraction
|
||||||
if IsTextAt(' ', ASection, next) and
|
if (IsTokenAt(nftSpace, ASection, next) or IsTextAt(' ', ASection, next)) and
|
||||||
IsNumberAt(ASection, next+1, nf, num, next) and
|
IsNumberAt(ASection, next+1, nf, num, next) and
|
||||||
IsTokenAt(nftFraction, ASection, next) and
|
IsTokenAt(nftFraction, ASection, next) and
|
||||||
IsNumberAt(ASection, next+1, nf, denom, next) and
|
IsNumberAt(ASection, next+1, nf, denom, next) and
|
||||||
@ -659,7 +655,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// What is left must be a custom format.
|
// If we get here it must be a custom format.
|
||||||
FSections[ASection].NumFormat := nfCustom;
|
FSections[ASection].NumFormat := nfCustom;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1151,7 +1151,7 @@ begin
|
|||||||
DupeString('#', ANumeratorDigits), DupeString('#', ADenominatorDigits)
|
DupeString('#', ANumeratorDigits), DupeString('#', ADenominatorDigits)
|
||||||
]);
|
]);
|
||||||
if AMixedFraction then
|
if AMixedFraction then
|
||||||
Result := '#" "' + Result;
|
Result := '# ' + Result;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
|
@ -20,12 +20,21 @@
|
|||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<StringTable ProductVersion=""/>
|
<StringTable ProductVersion=""/>
|
||||||
</VersionInfo>
|
</VersionInfo>
|
||||||
|
<MacroValues Count="1">
|
||||||
|
<Macro1 Name="LCLWidgetType" Value="win32"/>
|
||||||
|
</MacroValues>
|
||||||
<BuildModes Count="3">
|
<BuildModes Count="3">
|
||||||
<Item1 Name="Release" Default="True"/>
|
<Item1 Name="Release" Default="True"/>
|
||||||
<Item2 Name="Debug">
|
<Item2 Name="Debug">
|
||||||
|
<MacroValues Count="1">
|
||||||
|
<Macro1 Name="LCLWidgetType" Value="win32"/>
|
||||||
|
</MacroValues>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="11"/>
|
<Version Value="11"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="bin\$(TargetCPU)-$(TargetOS)\BiffExplorer"/>
|
||||||
|
</Target>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
<OtherUnitFiles Value="mrumenu"/>
|
<OtherUnitFiles Value="mrumenu"/>
|
||||||
@ -48,6 +57,9 @@
|
|||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
</Item2>
|
</Item2>
|
||||||
<Item3 Name="Debug with heaptrace">
|
<Item3 Name="Debug with heaptrace">
|
||||||
|
<MacroValues Count="1">
|
||||||
|
<Macro1 Name="LCLWidgetType" Value="win32"/>
|
||||||
|
</MacroValues>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="11"/>
|
<Version Value="11"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
@ -165,7 +177,6 @@
|
|||||||
<Unit10>
|
<Unit10>
|
||||||
<Filename Value="betypes.pas"/>
|
<Filename Value="betypes.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="beTypes"/>
|
|
||||||
</Unit10>
|
</Unit10>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
|
Reference in New Issue
Block a user