Xceed Grid for WinForms v4.3 Documentation
Using CustomizeReportStyleForm

Welcome to Xceed Grid for WinForms v4.3 > Basic Concepts > Reporting > Using CustomizeReportStyleForm

Roughly 140 different properties such as color, height and alignment control the appearance of over a dozen report elements, such as page headers/footers, column headers and groups. These properties are called “report styles” and can be grouped into “report style sheets” (see the Report styles and report style sheets topic for details). 

In addition to GenerateReportForm, Xceed provides a second form for end-users called CustomizeReportStyleForm. This form allows end-users to modify report styles used in a report and to save settings in report style sheets. 

This form can be made available in the GenerateReportForm by using the constructor of this class that specifies a folder in which report styles are saved:

VB.NET Copy Code

Imports Xceed.Grid.Reporting 

Dim generateReport As New GenerateReportForm( Me.gridControl1, "D:\Temp\styleFolder" )

generateReport.ShowDialog()

C# Copy Code

using Xceed.Grid.Reporting; 

GenerateReportForm generateReport = new GenerateReportForm( this.gridControl1, "D:\\Temp\\styleFolder" );

generateReport.ShowDialog();

Clicking on the New or Edit button in the Generate Report form that this code creates will bring up the following form:

Most of the visual aspects of the grid elements are “ambient”, meaning that by default they “inherit” a setting (such as a color or a font) from a “parent” element. For more information, see the Ambientness topic. The appearance of the report elements that can be changed by the end-user are shown in the Report Elements list box. The properties associated with these elements are presented in the Report Element Properties list box just below. A sample page reflecting the current settings is provided in the Preview section to the right in the form. 

By changing the name of the style in the Style Name field and then clicking OK, you can save the current report style under another name. 

When the Add alternating data row link in the Customize Report Style form is clicked, another style for the data rows is added to the list of Report Elements. When the report is generated (by printing, previewing or exporting it), the reporting engine alternates between this new report style and the report style defined in the Data Rows report element. Similarly, when the Add sub-group level is clicked, a style for the next group level is added. Note that the reporting engine does not alternate between these styles as with the data rows. Each additional sub-group style is applied to the same group level. Alternating data row report styles and sub-group report styles can be removed by clicking on the "x" symbol next to them in the Report Elements area of the form. 

CustomizeReportStyleForm can also be instantiated and displayed independently of GenerateReportForm, letting you use it as you see fit in your own application:

VB.NET Copy Code

Imports Xceed.Grid.Reporting 

Dim customizeReportStyle As New CustomizeReportStyleForm( "D:\Temp\styleFolder\style.xml" )CustomizeReportStyle.ShowDialog()

C# Copy Code

using Xceed.Grid.Reporting; 

CustomizeReportStyleForm customizeReportStyle = new CustomizeReportStyleForm( "D:\\Temp\\styleFolder\\style.xml" );
customizeReportStyle.ShowDialog();

CustomizeReportStyleForm source code

The C# source code for CustomizeReportStyleForm is provided for developers who wish to modify the form for their own applications. The Visual Studio 2003 project is available in the [Program Files]\Xceed\Xceed Grid for WinForms [version]\Custom Forms folder. 

To use a modified version of the CustomizeReportStyleForm, developers must recompile the Xceed.Grid.Reporting.ReportConfigForms project, and include the generated assembly in their project. This assembly must then also be distributed along with the compiled version of their application.