Executing the example requires that the repository contains a workbook with the OBJ123 identifier in which title settings are changed.
Add links to the following system assemblies:
Drawing.
Express.
Metabase (only for Fore).
Sub UserProc;
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
Exp: IEaxAnalyzer;
Title: IGxTitle;
Begin
MB := MetabaseClass.Active;
//Open a workbook to edit
MObj := MB.ItemById("OBJ123").Edit;
Exp := MObj As IEaxAnalyzer;
Title := Exp.TitleBar;
//Display a workbook title
Title.Visible := True;
//Text
Title.Text := "Report: &[Name]" + #13+#10 + "Date and time of creation: &[Date] &[Time]";
//Background and font color
Title.BackgroundColor := GxColor.FromName("LavenderBlush");
Title.TextColor := GxColor.FromName("SlateBlue");
//Horizontal alignment of text
Title.TextAlignment := GxStringAlignment.Near;
//Vertical alignment of text
Title.VerticalAlignment := GxVerticalAlignment.Center;
//Text wrapping
Title.WrappedText := True;
//Autofit title height
Title.AutoHeight := True;
//Maximum height
Title.Height := 50;
//Using title as a control
Title.IsControl := True;
MObj.Save;
End Sub UserProc;
After executing the example the workbook title is displayed with changed format. The workbook title will contain its header, date and time of its creation.
The defined procedure is the Main entry point in the Program module of the .NET assembly. The Express, Metabase, Drawing system assemblies must be imported to this module from the Prognoz.Platform.Interop system assembly.
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
Exp: IEaxAnalyzer;
Title: IGxTitle;
GxColorCls: GxColorClassClass = New GxColorClassClass();
Begin
MB := Params.Metabase;
//Open a workbook to edit
MObj := MB.ItemById["OBJ123"].Edit();
Exp := MObj As IEaxAnalyzer;
Title := Exp.TitleBar;
//Display a workbook title
Title.Visible := True;
//Text
Title.Text := " Report: &[Name] \u000D\u000A Date and time of creation: &[Date] &[Time]";
//Background and font color
Title.BackgroundColor := GxColorCls.FromName("LavenderBlush");
Title.TextColor := GxColorCls.FromName("SlateBlue");
//Horizontal alignment of text
Title.TextAlignment := GxStringAlignment.gsaNear;
//Vertical alignment of text
Title.VerticalAlignment := GxVerticalAlignment.gvaCenter;
//Text wrapping
Title.WrappedText := True;
//Autofit title height
Title.AutoHeight := True;
//Maximum height
Title.Height := 50;
//Using title as a control
Title.IsControl := True;
MObj.Save();
End Sub;
The result of example execution matches with that of the Fore example.
See also: