Xtrareport allows you to specify the number of records and fill in blank rows.

Source: Internet
Author: User

In the detail event:

Int I = 0;
Private void onbeforeprint (Object sender, system. Drawing. Printing. printeventargs e ){
// Control the number of items displayed on each page
If (I! = 0 & I % 8 = 0) // 8 entries per page
{
Detail. pagebreak = devexpress. xtrareports. UI. pagebreak. beforeband;
}
Else
{
Detail. pagebreak = devexpress. xtrareports. UI. pagebreak. None;
}
I ++;
}

In the table event:

Private void onbeforeprint (Object sender, system. Drawing. Printing. printeventargs e ){
//////////////////////////////////////// ///// // Replace the dataset "storagebillmatitem"
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 );
}
}

Related Article

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.