PredefinedStyle(Index: Integer): IXmlDomElement;
Index. Standard style index.
The PredefinedStyle property returns standard style in XML format.
To get standard style index, use the IStyledEntity.PredefinedStyleIndex property.
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:
The number of standard styles will be displayed in the console window.
The image used for standard style preview with the 4 index will be saved to the C:\Style.emf file.
The standard style in the XML format will be saved to the C:\Style.xml file.
See also: