IStyledEntity.PredefinedStyle

Syntax

PredefinedStyle(Index: Integer): IXmlDomElement;

Parameters

Index. Standard style index.

Description

The PredefinedStyle property returns standard style in XML format.

Comments

To get standard style index, use the IStyledEntity.PredefinedStyleIndex property.

Example

Executing the example requires an express report with the EAX_STYLE identifier containing a table.

Add links to the Drawing, Express, Metabase, Xml system assemblies in the unit.

Sub UserProc;
Var
    Mb: IMetabase;
    Report: IEaxAnalyzer;
    Entity: IStyledEntity;
    Index: Integer;
    Img: IGxImage;
    Style: IXMLDOMElement;
    Doc: FreeThreadedDOMDocument60;
Begin
    // Get current repository
    Mb := MetabaseClass.Active;
    // Get express report
    Report := Mb.ItemById("EAX_STYLE").Edit As IEaxAnalyzer;
    // Get table style
    Entity := report.Grid.Style.InternalStyle As IStyledEntity;
    // Display the number of standard styles in the console window
    Debug.WriteLine("Number of standard styles: " + entity.PredefinedStyleCount.ToString);
    // Determine index of standard style
    Index := 4;
    Entity.PredefinedStyleIndex := Index;
    // Get image used for standard style preview
    Img := Entity.PredefinedStylePreview(Index);
    // Save image used for standard style preview to EMF file
    Img.SaveToFile("C:\Style.emf");
    // Get standard style in XML format
    Style := Entity.PredefinedStyle(Index);
    // Create an XML document
    Doc := New FreeThreadedDOMDocument60.Create;
    // Add a standard style in XML format to XML document
    Doc.appendChild(Style);
    // Save XML document
    Doc.save("C:\Style.xml");
End Sub

After executing the example:

See also:

IStyledEntity