YOUSEFUL / DELPHI / COMPONENTS

TAtlasNumberFormat

The four number formats of a workbook cell: general, fixed, percent and currency.

Enumeration Unit Atlas.Spreadsheet · Product Atlas VCL

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

MemberKindWhat it does
anfGeneralvalueThe shortest invariant form (-1234.5678); Decimals is ignored.
anfFixedvalueDecimals digits after the point: -1234.57.
anfPercentvalueThe value times 100 with Decimals digits and %: 0.125 displays 12.50%.
anfCurrencyvalueA $ prefix and Decimals digits: $1234.50, $-1234.57 for a negative value.

Values

anfGeneral value

anfGeneral

The shortest invariant form (-1234.5678); Decimals is ignored.

anfFixed value

anfFixed

Decimals digits after the point: -1234.57.

anfPercent value

anfPercent

The value times 100 with Decimals digits and %: 0.125 displays 12.50%.

anfCurrency value

anfCurrency

A $ 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.

pascal
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;

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