IStyleSheet.Add

Syntax

Add([Key: Integer = 0]; [Id: String = ""]): IStyleContainer;

Parameters

Key. 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.

Id. 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.

Description

The Add method adds a style container to the styles table.

Example

Executing the example requires that the repository contains a styles table with the GLOBAL_STYLE identifier.

Sub UserProc;
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 UserProc;

After executing the example a new style container is added to the styles table. 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:

IStyleSheet