YOUSEFUL / DELPHI / COMPONENTS
TAtlasNumberFormat
The four number formats of a workbook cell: general, fixed, percent and currency.
Description
Used in TAtlasCellFormat.NumberFormat. All formats use the invariant decimal point and no thousands separator; there is no locale or currency setting. Text cells and error codes are displayed unchanged.
Members
| Member | Kind | What it does |
|---|---|---|
anfGeneral | value | The shortest invariant form (-1234.5678); Decimals is ignored. |
anfFixed | value | Decimals digits after the point: -1234.57. |
anfPercent | value | The value times 100 with Decimals digits and %: 0.125 displays 12.50%. |
anfCurrency | value | A $ prefix and Decimals digits: $1234.50, $-1234.57 for a negative value. |
Values
anfGeneral value
anfGeneralThe shortest invariant form (-1234.5678); Decimals is ignored.
anfFixed value
anfFixedDecimals digits after the point: -1234.57.
anfPercent value
anfPercentThe value times 100 with Decimals digits and %: 0.125 displays 12.50%.
anfCurrency value
anfCurrencyA $ prefix and Decimals digits: $1234.50, $-1234.57 for a negative value. No other currency symbol.
Examples
Display one value in every format
Prints general -1234.5678, fixed -1234.57, percent -123456.78% and currency $-1234.57.
uses System.SysUtils, Atlas.Spreadsheet;
procedure ShowNumberFormats;
const
Names: array[TAtlasNumberFormat] of string = ('general', 'fixed', 'percent', 'currency');
var
Book: TAtlasWorkbook;
Kind: TAtlasNumberFormat;
Format: TAtlasCellFormat;
begin
Book := TAtlasWorkbook.Create(nil);
try
Book.SetCell('A1', '-1234.5678');
for Kind := Low(TAtlasNumberFormat) to High(TAtlasNumberFormat) do
begin
Format := TAtlasCellFormat.Default;
Format.NumberFormat := Kind;
Book.SetCellFormat('A1', Format);
Writeln(Names[Kind].PadRight(10), Book.Display('A1'));
end;
finally
Book.Free;
end;
end;Related
TAtlasCellFormat · TAtlasWorkbook
Also in Atlas VCL
TAtlasTable · TAtlasGrid · TAtlasValueEdit · TAtlasTree · TAtlasWorkbook · TAtlasSheetGrid · TAtlasPivot · TAtlasInspector · TAtlasRichEdit · TAtlasSpellChecker · TAtlasChart · TAtlasGauge · TAtlasThemer · TAtlasWizard · TAtlasWorkspace · TAtlasCommandBar · TAtlasActionTile · TAtlasTileBoard · TAtlasNavigation · TAtlasMap · TAtlasGraph · TAtlasDiagram · TAtlasPrintDocument · TAtlasSchedule · TAtlasScheduler · TAtlasTaskPlan · TAtlasGantt · TAtlasPdfDocument · TAtlasPdfViewer