【问题标题】:DEVEXPRESS - xtrareport - page breakDEVEXPRESS - xtrareport - 分页符
【发布时间】:2012-03-14 10:25:25
【问题描述】:

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

你知道这是怎么做的吗?

【问题讨论】:

    标签: c# devexpress xtrareport


    【解决方案1】:

    您可以在某些条件下强制分页。 This page 底部有一个例子。

    嗨,卡里,

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

    谢谢,
    安德鲁

    【讨论】:

      【解决方案2】:

      您需要创建一个报表合并。

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

      这是一个例子:

      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();            
      
          }
      

      【讨论】:

        猜你喜欢
        • 2014-12-28
        • 2018-07-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-08-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多