xtrareports-4807-feature-guide-to-devexpress-reports-customize-appearance-store-report-style-sheets.md
This tutorial describes how to create and save report style sheets at design time within Visual Studio, and conditionally load them at runtime.
To create a table report in this tutorial, start with a report that is bound to the “Products” table of the sample Northwind database. To learn more about binding a report to a data source, see Provide Data to Reports. In this tutorial, you will start with the following report layout.
To add a new style sheet, switch to the Report Explorer, right-click the Styles node or its sub-node and in the invoked context menu, select Add Style.
Then, right-click the newly added style and select Edit Styles… in the context menu. In the invoked Styles Editor , specify the style name (“ myOddStyle “), and save it as three separate style sheets ( myStyle_Rose.repss , myStyle_Yellow.repss and myStyle_Blue.repss ) in the Styles folder of the application’s directory. Each style sheet has a different BackColor setting.
To assign a style to the XRTable in the Detail band, expand its XRControl.Styles property in the Properties window, and set the OddStyle property to myOddStyle.
Add a parameter to the report. To do this, right-click the Parameters section in the Field List window, and choose Add Parameter in the invoked context menu.
In the invoked dialog, adjust the properties of the parameter as shown in the following image.
Programmatically assign the style sheets to the report depending on the parameter value. To do this, handle the report’s XRControl.BeforePrint event in the following way.
See Also