IPrxReport.StyleSheet

Syntax

StyleSheet: IStyleSheet;

Description

The StyleSheet property determines the styles table, which styles are used to format cells of regular report tables.

Example

Consider the example of connecting a styles table to a regular report.

Executing the example requires that the repository contains a regular report with the REPORT_GLOBALSTYLE identifier and a styles table with the GLOBAL_STYLE identifier.

Add links to the Drawing, Metabase, Report system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Report: IPrxReport;
    StyleSheet: IStyleSheet;
Begin
    // Open regular report for edit
    MB := MetabaseClass.Active;
    MObj := MB.ItemById("REPORT_GLOBALSTYLE").Edit;
    Report := MObj As IPrxReport;
    // Add a styles table for report
    StyleSheet := MB.ItemById("GLOBAL_STYLE").Bind As IStyleSheet;
    Report.StyleSheet := StyleSheet;
    // Save report
    MObj.Save;
End Sub UserProc;

After executing the example the styles table with the GLOBAL_STYLE identifier is assigned as the formatting styles set for a regular report with the REPORT_GLOBALSTYLE identifier.

Consider the example of applying a style from the styles table already connected to a regular report.

Executing the example requires that the repository contains a regular report with the REPORT_GLOBALSTYLE identifier and a connected styles table. The styles table can contain several cell styles.

Add links to the Drawing, Metabase, Report, Tab system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;  
    Report: IPrxReport;
    ContainerCollection: IStyleContainerCollection;
    StyleContainer: IStyleContainer;
    StyledEntity: IStyledEntity;
    StyleSheet: IStyleSheet;
    TabSheet: ITabSheet;
    TabStyle: ITabCellStyle;
Begin
    // Open regular report for edit
    MB := MetabaseClass.Active;
    MObj := MB.ItemById("REPORT_GLOBALSTYLE").Edit;
    Report := MObj As IPrxReport;
    // Get table of opened report sheet
    TabSheet := (Report.ActiveSheet As IPrxTable).TabSheet;
    // Get report styles table
    StyleSheet := Report.StyleSheet;
    // Search for containers containing table cell styles
    ContainerCollection := StyleSheet.FindByTag("TAB");
    // Select the second container among the found ones
    StyleContainer := ContainerCollection.Item(1);
    // Apply the selected style to the A0:K10 cell range
    TabStyle := New TabCellStyle.Create;
    StyledEntity := TabStyle As IStyledEntity;
    StyledEntity.LoadStyleFromContainer(StyleContainer);
    TabSheet.Cells(0,0,10,10).Style := TabStyle;
    // Save report
    MObj.Save;
End Sub UserProc;

After executing the example the second style from the styles table is applied to the A0:K10 cell range in the regular report with the REPORT_GLOBALSTYLE identifier.

See also:

IPrxReport