Add([Key: Integer = 0]; [Id: String = ""]): IStyleContainer;
A Key is the optional parameter that determines the key of the added style container. It is 0 by default. The next key in succession will be generated on adding a container without the indication of the key; this depends on the keys that are available.
A Name is the optional parameter that determines the identifier of the added style container. It is "" by default. The new identifier that contains "I" + the key of the new style container will be generated on adding a container without the indication of identifier.
The Add method adds a style container to the styles table.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
StyleSheet: IStyleSheet;
Style: IStyleContainer;
TabSty: ITabCellStyle;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("Global_Style").Edit;
StyleSheet := MObj As IStyleSheet;
StyleSheet.Clear;
Style := StyleSheet.Add(10);
TabSty := New TabCellStyle.Create;
TabSty.Font.Name := "Times New Roman";
TabSty.Font.Size := 16;
TabSty.Font.Color := GxColor.FromName("Red");
TabSty.SaveToContainer(Style);
MObj.Save;
End Sub Main;
After executing the example a new style container is added to the styles table with the Global_Style identifier. The name and the key for this container will be generated automatically after that the font style that is stored in this container will be changed.
See also: