Xtrareport implementing the specified number of records and filling blank lines

Source: Internet
Author: User

In the event of detail:

int i=0;
private void Onbeforeprint (object sender, System.Drawing.Printing.PrintEventArgs e) {
Control the number of bars displayed per page of reports
if (i!=0&&i%8==0)//per page 8 article
{
Detail.pagebreak = DevExpress.XtraReports.UI.PageBreak.BeforeBand;
}
Else
{
Detail.pagebreak = DevExpress.XtraReports.UI.PageBreak.None;
}
i++;
}


In the event of table:

private void Onbeforeprint (object sender, System.Drawing.Printing.PrintEventArgs e) {
Data set "Storagebillmatitem" is replaced
if (i== (System.Data.DataSet) (Xtrareport1.datasource)). tables["Storagebillmatitem"]. Rows.Count)
{
xrtable table = xrtable2;//template Detail Band xrtable
int iheight = table. Rows[table. ROWS.COUNT-1]. Height;


int spacerowcount = 8-(i)%8;
xrtablerow[] Xrrow = new Xrtablerow[spacerowcount];


for (int k=0;k<spacerowcount; k++)
{
XRROW[K] = new Xrtablerow ();
XRROW[K]. size = new size (table. Width, iheight);
XRROW[K]. Location = new Point (table. Location.x, K * iheight);
XRROW[K]. Borders = (DevExpress.XtraPrinting.BorderSide) ((Borderside.left | Borderside.right) | Borderside.top);
XRROW[K]. BorderWidth = 1;
XRROW[K]. bordercolor = table. Rows[table. ROWS.COUNT-1]. bordercolor;
Createcell
Xrtablerow row = table. Rows[table. ROWS.COUNT-1];
Createcellarray (Xrrow[k], row);
}
XrTable2.Rows.AddRange (Xrrow);
}
}


<summary>
Createcell
</summary>
<param name= "Xrrow" >current row</param>
<param name= "Xrrowtemplate" >row template</param>
private void Createcellarray (Xrtablerow xrrow, Xrtablerow xrrowtemplate)
{
int xmargin = 0;
for (int i = 0; i < XrRowTemplate.Cells.Count; i++)
{
Xrtablecell Xrcell = new Xrtablecell ();
Xrcell. BorderWidth = 1;
Xrcell. Borders = (DevExpress.XtraPrinting.BorderSide) ((Borderside.left | Borderside.right) | Borderside.top);
Xrcell. Width = Xrrowtemplate.cells[i]. Width;
Xrcell. BackColor = Xrrowtemplate.cells[i]. BackColor;
Xrcell. Height = Xrrowtemplate.height;
if (i! = 0)
{
Xrcell. Location = new Point (Convert.ToInt32 (Xmargin + xrrowtemplate.cells[i). Width), 0);
}
Else
{
Xrcell. Location = new Point (0, 0);
}
XRROW.CELLS.ADD (Xrcell);
}
}

Http://www.dxper.net/documents/html/DevExpressXtraReportsUIXtraReport_ScriptLanguagetopic.htm

Xtrareport implementing the specified number of records and filling blank lines

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.