You can set custom style values using the Report Settings window, and then apply the styles to controls using the ClassName property in the Properties Window. If you want to apply these same styles to controls in other reports without setting them up each time, you can export them to XML files of type *.reportstyle which you can then select in the Report Settings window. Reports using external style sheets have these styles applied before the report is run.
To save an external style sheet
- With an ActiveReport open and selected in Visual Studio, drop down the Report menu and select Settings.
- In the Report Settings window that appears, click the Styles button to view the style settings.
- By default, ActiveReports has six predefined styles: Normal, Heading1, Heading2, Heading3, DetailRecord, and ReportTitle. Click each of these styles in the list to modify them using the fields to the right, or click the New button to create a new style.
- To save your styles to an external XML *.reportstyle file, click the Export styles to file button.
- In the Save As dialog that appears, navigate to the location in which you want to save the style sheet, provide a name for the file, and click the Save button.
- Back on the Report Settings window, click the OK button to close the window and save the styles in the current report.
To import an external style sheet at design time
- With an ActiveReport open and selected in Visual Studio, drop down the Report menu and select Settings.
- In the Report Settings window that appears, click the Styles icon to view the style settings.
- Click the Import styles from file button. A message box warns that current styles will be deleted. Click Yes to continue.
- In the Open dialog that appears, navigate to the *.reportstyle file that you want to use and click the Open button.
To apply an external style sheet at run time
To make a style sheet available at run time, double-click the grey area of the report to create an event-handling method for the ReportStart event of the report. Add code inside the handler to make the style style sheet available to the report.
The following examples show what the code for the method looks like.
| Visual Basic.NET code. Paste INSIDE the ReportStart event. | Copy Code |
|---|---|
| Me.LoadStyles("C:\My.reportstyle") | |
| C# code. Paste INSIDE the ReportStart event. | Copy Code |
|---|---|
| this.LoadStyles("C:\My.reportstyle"); | |
To apply styles to controls at design time
You can apply styles to four types of ActiveReports controls: CheckBox, Label, TextBox, and ReportInfo.
- Select the control to which you want to apply the style.
- In the ActiveReports toolbar, drop down the Styles combo box and select the style.
- Or in the Properties Window, drop down the ClassName field and select the style to apply.
- When you run the report, ActiveReports applies the default style values for the selected style, or the style values contained in the specified external style sheet.
To apply styles to controls at run time
You can apply styles to four types of ActiveReports controls: CheckBox, Label, TextBox, and ReportInfo.
To apply a style at run time, double-click the section of the report containing the control to create an event-handling method for the Format event of the section. Add code inside the handler to apply the style to the control.
The following examples show what the code for the method looks like.
| Visual Basic.NET code. Paste INSIDE the Format event. | Copy Code |
|---|---|
| Me.TextBox1.ClassName = "Heading1" | |
| C# code. Paste INSIDE the Format event. | Copy Code |
|---|---|
| this.textBox1.ClassName = "Heading1"; | |
Sample ReadMe Files
NEW Style Sheets Sample
Hide All