首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DEVEXPRESS - xtrareport -分页符

DEVEXPRESS - xtrareport -分页符
EN

Stack Overflow用户
提问于 2012-03-14 18:25:25
回答 2查看 18.8K关注 0票数 5

我有一个超过300行的datatable。我希望每页只显示10行。我想强制xtrareport在10行后中断。

你知道这是怎么做的吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-03-14 18:30:41

您可以在某些情况下强制分页符。This page在底部有一个示例。

Hi Cary

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

谢谢,

Andrew

票数 5
EN

Stack Overflow用户

发布于 2012-03-14 18:39:15

您需要创建一个Repport合并。

  • 第一步是创建一个主报告。
  • 然后,每10行创建一个第二个报告。
  • ,然后在主报告中添加第二个报告。

下面是一个示例:

代码语言:javascript
复制
private void printInvoicesButton_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
    {
        int[] selection = this.ordersGridView.GetSelectedRows();
        XtraReport reportMerge = new XtraReport();
        reportMerge.CreateDocument();

        IList<XtraReport> reportList = new List<XtraReport>();

        // 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<reportList.Count;i++)
        {
            reportMerge.Pages.AddRange(reportList[i].Pages);
        }

        // Show the report's preview.
        reportMerge.ShowPreviewDialog();            

    }
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9700059

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档