First, create two xtrareport. One is the master and the other is the slave
MASTER: add three xrsubreport controls to detail.
View code
/// <Summary> /// Print /// </Summary> /// <Param name = "ds"> Dataset </Param> /// <Param name = "printername"> Printer name </Param> Public Newsuningreport (datatable dt1, datatable dt2, datatable dt3, String Printername) {initializecomponent (); If (Dt1! = Null ) {Suningreport sunrep1 = New Suningreport (dt1 ); This . Xrsubreport1.reportsource = Sunrep1 ;} If (Dt2! = Null ) {Suningreport sunrep2 = New Suningreport (dt2 ); This . Xrsubreport2.reportsource = Sunrep2 ;} If (Dt3! = Null ) {Suningreport sunrep3 = New Suningreport (dt3 ); This . Xrsubreport3.reportsource = Sunrep3 ;} This . Printername = Printername; This . Print ();}
Set your report format and bind data from it
View code
Public Suningreport (datatable DT) {initializecomponent (); If (DT! = Null & DT. Rows. Count> 0 ){ This . Xrbarcode1.text = DT. Rows [ 0 ] [ " Order 1 " ]. Tostring (); This . Xrbarcode2.text = DT. Rows [ 0 ] [ " Order 2 " ]. Tostring (); This . Xrlabel2.text = string. Format (" {0} boxes in total " , DT. Rows [ 0 ] [ " A total of several boxes " ]. Tostring ()); This . Xrlabel3.text = string. Format ( " Case {0} " , DT. Rows [ 0 ] [ " Number of boxes " ]. Tostring ()); This . Detailreport. datasource = DT; This . Xrtablecell5.databindings. Add ( " Text " , DT, " Product NO. " ); This . Xrtablecell6.databindings. Add ( " Text " , DT, " Product Name " ); This . Xrtablecell7.databindings. Add ( " Text " , DT, " Item quantity " ); This . Xrtablecell8.databindings. Add (" Text " , DT, " Commodity location " );}}
Call Method
View code
For ( Int J = 0 ; J <Ds. Tables. Count; j = J + 3 ) {Datatable dt1 =Null ; Datatable dt2 = Null ; Datatable dt3 = Null ; If (Count> J) {dt1 = DS. Tables [J];} If (Count> J + 1 ) {Dt2 = Ds. Tables [J + 1 ];} If (Count> J + 2 ) {Dt3 = Ds. Tables [J + 2 ];} Newsuningreport Suning = New Newsuningreport (dt1, dt2, dt3, printername );}