Report Design: How to use report script to set number of items to be printed per page

From AutoCount Resource Center

Question : How can I use report script to set only 10 items to be printed per page for Invoice?

Version : 1.8 / 1.9 / 2.0

Answer :

1) Go to Sales > Invoice, click on Report > Design Document Style Report.

2) Select the report name and click on Design.

3) Go to Scripts tab.

4) Copy the following scripts and paste at bottom of the scripts.

Script template:

int a=0; private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)

 DevExpress.XtraReports.UI.DetailBand band = (DevExpress.XtraReports.UI.DetailBand)sender;
 band.PageBreak = PageBreak.AfterBand;
}else band.PageBreak = PageBreak.None;


Remark : The if(a==10) means 10 items per page, if you want 15 items per page just change the figure 10 to 15.

5) Back to Designer tab and click on InvoiceDetail, at Property Grid (at right panel) , scroll down and look for Behavior, expand the Scripts, for Before Print > Select OnBeforePrint.

6) After selected OnBeforePrint, system will switch to the Scripts tab. Now you may click on File > Save As.., fill in your report name and click on Save.

7) Try to preview with the newly designed report. Now every page has 10 items only.

Please refer to the following PDF file for an alternative way (Formatting Rule) to do page break.

Page break by using Formatting Rules

By : CK 190108, Lay Swan 190123, P190123

Go to menu

AutoCount Accounting 2.0 & 2.1

AutoCount Accounting 1.8 / 1.9
AutoCount Payroll
AutoCount POS

AutoCount On The Go
AutoCount Accounting Plug-In Documentations