Family: String;
Family: string;
The Family property returns font name.
To get font size, use the IGxFontBase.Size property.
Executing the example requires that the repository contains a regular report with the REGULAR_REPORT_IGXFONTBASE identifier, in which the first cell must be filled with any data.
Add links to the Drawing, Metabase, Report, Tab system assemblies.
Sub userproc;
Var
mb: IMetaBase;
regrep: IPrxReport;
sheet: IPrxSheet;
table: IPrxTable;
range: ITabSheet;
diap1: ITabRange;
font: IGxFontBase;
family, style: String;
size: Double;
Begin
// Open regular report for edit
mb := MetabaseClass.Active;
regrep := mb.ItemById("REGULAR_REPORT_IGXFONTBASE").Edit As IPrxReport;
// Get the first cell of regular report
sheet := regrep.Activesheet;
table := sheet As IPrxTable;
range := table.TabSheet;
diap1 := range.Cell(0, 0);
// Get font of the first cell
font := diap1.Style.Font.AsGxFont;
// Display font name in the console window
family := font.Family;
debug.WriteLine("Font name: " + family);
// Display font size in the console window size := font.Size;
debug.WriteLine("Font size = " + size.ToString);
// Display font style in the console window
style := font.Style.ToString;
debug.WriteLine("Font style: " + style);
End Sub userproc;
After executing the example the console window displays basic font parameters.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetaBase;
regrep: IPrxReport;
sheet: IPrxSheet;
table: IPrxTable;
range: ITabSheet;
diap1: ITabRange;
font: IGxFontBase;
family, style: String;
size: Double;
Begin
// Open regular report for edit
mb := Params.Metabase;
regrep := mb.ItemById["REGULAR_REPORT_IGXFONTBASE"].Edit() As IPrxReport;
// Get the first cell of regular report
sheet := regrep.Activesheet;
table := sheet As IPrxTable;
range := table.TabSheet;
diap1 := range.Cell[0, 0];
// Get font of the first cell
font := diap1.Style.Font.AsGxFont();
// Display font name in the console window
family := font.Family;
System.Diagnostics.Debug.WriteLine("Font name: " + family);
// Display font size in the console window size := font.Size;
System.Diagnostics.Debug.WriteLine("Font size = " + size.ToString());
// Output font style to the console window
style := font.Style.ToString();
System.Diagnostics.Debug.WriteLine("Font style: " + style.ToString());
End Sub;
See also: