How do I print multiple devexpress report files at the same time?

Source: Internet
Author: User

To implement this feature, You first need to print the report using the Xtrareport.printdialog and Xtrareport.print methods, and then you need to process the report's Xtrareport.printingsystem Printingsystembase.startprint event.

Key code:

private void Button1_Click (object sender, EventArgs e) {

XtraReport1 report1 = new XtraReport1 ();

Xtrareport[] reports = new xtrareport[] {new XtraReport2 (), New XtraReport3 ()};

Reportprinttool pt1 = new Reportprinttool (REPORT1);

Pt1. Printingsystem.startprint + = new Printdocumenteventhandler (printingsystem_startprint);

foreach (Xtrareport in reports) {

Reportprinttool pts = new Reportprinttool (the);

Pts. Printingsystem.startprint + = new Printdocumenteventhandler (Reportsstartprinteventhandler);

}

Print a report

Pt1. PrintDialog ();

foreach (Xtrareport in reports) {

Reportprinttool pts = new Reportprinttool (the);

Pts. Print ();

}

}

Handling Startprint Events

void Printingsystem_startprint (object sender, Printdocumenteventargs e) {

Prnsettings = e.printdocument.printersettings;

}

private void Reportsstartprinteventhandler (object sender, Printdocumenteventargs e) {

int pagecount = E.printdocument.printersettings.topage;

E.printdocument.printersettings = prnsettings;

If the report contains a different number of pages, and you need to print all pages, follow this step

E.printdocument.printersettings.topage = PageCount;

}

Click to download examples of this site in addition to the note reproduced, are original site or translation
Welcome to any form of reprint, but please be sure to indicate the source, respect for the achievements of others Labor
Reprint Please specify: Article reproduced from: DevExpress Control Chinese network [http://www.devexpresscn.com/]
This article address: http://www.devexpresscn.com/DevExpress-Resources/Demo-41.html

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.