The first two methods are the same as winform, which can pass parameters, arrays, object objects, datatable, etc.
1. Use constructors
Usage:
In Report
Public partial class xtrareport1: devexpress. xtrareports. UI. xtrareport
{
Private int test1;
Public form1 (INT test1)
{
This. test1 = test1;
Initializecomponent ();
}
}
Call report
Int test1 = 1;
Xtrareport1 report = new xtrareport1 (test1 );
Report. Show ();
2. use attribute
usage:
in Report
Public partial class xtrareport1: devexpress. xtrareports. UI. xtrareport
{< br> Public form1 ()
{< br> initializecomponent ();
}< br> private int test1;
Public int test1
{< br> set {test1 = value ;}< br> get {return test1 ;}
}< BR >}< br> call Report
xtrareport1 report = new xtrareport1 ();
report. test1 = 1;
report. show ();
3. PASS Parameters Using Dataset
On the report design page, pull dataset from the toolbar data to the page, select an untyped dataset, and add table and column to the pulled dataset. In the field list on the report page, the newly added tables and columns are automatically added, and the column in the Field List column is pulled to the report. After the design. InCodeMedium:
Private void detail_beforeprint (Object sender, system. Drawing. Printing. printeventargs E)
{
This. datasource = Ds. Table [0];
}
I have no problem using the above three methods.
However, I am allowing users to modify the report design.
Devexpress. xtrareports. UI. xtrareport report = devexpress. xtrareports. UI. xtrareport. fromfile (application. startuppath + "// reporttest. repx ");
Report. showdesigner ();
If 1st or two methods are used, no way can be done. Later, I had to work around it. I saved the data to be passed in XML, and then read the data in the XML file in the detail_beforeprint event.
View the help instructions as follows:
In the Assembly (represented by the. exe or. dll file) which produced the repx file. Its path is also mentioned in the repx file's header;
- In the current Assembly whereFromfileMethod is called from;
- In the Assemblies referenced by the current Assembly.
If this class type is not found, then an instance of the xtrareport class is created.
Also, the Saved state can be applied to the created report instance, ifLoadstateParameter is setTrue.
When you are free, use reflection to test whether the method of passing parameters in 1st and 2 can also implement Custom reports.