Summary of dynamically passing parameters to devexpress. xtrareports.

Source: Internet
Author: User

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;

    1. In the current Assembly whereFromfileMethod is called from;
    2. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.