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