YOUSEFUL / DELPHI / COMPONENTS
TAtlasCellFormat
How a TAtlasWorkbook cell displays its number and how TAtlasSheetGrid paints it.
Description
Start from TAtlasCellFormat.Default, change the fields you need and pass the record to TAtlasWorkbook.SetCellFormat. The number format and decimals affect Display; bold and colors are used by TAtlasSheetGrid for cells that have an explicit format.
Members
| Member | Kind | What it does |
|---|---|---|
NumberFormat | field | anfGeneral (default), anfFixed, anfPercent or anfCurrency; see TAtlasNumberFormat. |
Decimals | field | Digits after the decimal point for the fixed, percent and currency formats, 0..15 (default 2). |
Bold | field | Bold text in TAtlasSheetGrid (default False). |
Background | field | Cell background in TAtlasSheetGrid, a TColor value stored as Integer (default $FFFFFF, white). |
Foreground | field | Text color in TAtlasSheetGrid (default $000000, black). |
Default | method | Returns the default format: general, 2 decimals, not bold, black on white. |
Methods
Default method
class function Default: TAtlasCellFormat; static;Returns the default format: general, 2 decimals, not bold, black on white.
Fields
NumberFormat field
NumberFormat: TAtlasNumberFormat;anfGeneral (default), anfFixed, anfPercent or anfCurrency; see TAtlasNumberFormat.
Decimals field
Decimals: Integer;Digits after the decimal point for the fixed, percent and currency formats, 0..15 (default 2). The general format ignores it.
Bold field
Bold: Boolean;Bold text in TAtlasSheetGrid (default False).
Background field
Background: Integer;Cell background in TAtlasSheetGrid, a TColor value stored as Integer (default $FFFFFF, white).
Foreground field
Foreground: Integer;Text color in TAtlasSheetGrid (default $000000, black).
Examples
Highlight a total
For =2/3 the display becomes 0.7; HasCellFormat and Bold are then True.
uses Atlas.Spreadsheet;
procedure HighlightTotal(Book: TAtlasWorkbook; const Address: string);
var
Format: TAtlasCellFormat;
begin
Format := TAtlasCellFormat.Default; // general, 2 decimals, black on white
Format.NumberFormat := anfFixed;
Format.Decimals := 1;
Format.Bold := True;
Format.Background := $00E3EFE5; // a TColor value (pale green)
Book.SetCellFormat(Address, Format);
end;Related
TAtlasWorkbook · TAtlasNumberFormat · TAtlasSheetGrid
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