DEVEXPRESS – xtrareport – 分页符

我有一个超过300行的数据表。 我希望每个页面只显示10行。 我想迫使xtrareport在10行后中断。

有关如何做到这一点的任何想法?

您可以在某些条件下强制分页。 此页面底部有一个示例。

嗨卡里,

要完成此任务,您可以添加GroupFooter波段并将GroupFooter.PageBreak设置为AfterBand。 或者放置一个XRPageBreak控件,处理Detail.BeforePrint并根据需要调整XRPageBreak的可见性。 要获得处理行,您需要使用XtraReport.GetCurrentRow()方法。 请尝试此解决方案,并告诉我们结果。

谢谢,
安德鲁

您需要创建一个Repport Merging。

  • 第一步是创建一个主要的支持。
  • 然后,每10行创建第二个Repport。
  • 并在主要的支持中添加第二个支持。

这是一个例子:

private void printInvoicesButton_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int[] selection = this.ordersGridView.GetSelectedRows(); XtraReport reportMerge = new XtraReport(); reportMerge.CreateDocument(); IList reportList = new List(); // Create a report. //invoiceReport report = new invoiceReport(); for (int j = 0; j < selection.Length; j++) { XtraReport report = new XtraReport(); string filePath = @"Reports/invoiceReport1.repx"; report.LoadLayout(filePath); InvoiceData invoice = new InvoiceData(); for (int i = 0; i < DataRepository.Orders.Orders.Count; i++) { if ( ordersGridView.GetRowCellValue(selection[j], "InvoiceCode").Equals( DataRepository.Orders.Orders[i].InvoiceCode)) { BindingSource dataSource = new BindingSource(); invoice = InvoiceData.AdaptFrom(DataRepository.Orders.Orders[i], DataRepository.Orders, DataRepository.Products.Products, DataRepository.ProductOptionMaster, DataRepository.ProductOptionDataSet, DataRepository.CustomerShippingAddresses, DataRepository.Customers.UserMaster, DataRepository.AttributesData.Product_Attributes); dataSource.Add(invoice); report.DataSource = dataSource; //report.ShowPreview(); report.CreateDocument(); } } reportList.Add(report); } for(int i=0;i