zoukankan      html  css  js  c++  java
  • XtraReport 添加空行的办法,很详细

    这两天为了做报表,研究了一下XtraReport 。为了添加空行,想了很多办法。其中如果有分组时,网上给出的办法就会失败。
    现将经验公布一下,希望各位都能少走弯路。

    1.加入自定义函数CreateCellArray,用于创建空行。
    2.生成报表的 FillEmptySpace 事件,填写如下代码。
    3.tableDetail 是指细节 区带
    4.****注意,如果有分组,必须将分组PrintAtBottom设置为true,就是将其下沉。

     
    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.Bottom);
        xrcell.WidthF = xrRowTemplate.Cells.WidthF;
        xrcell.BackColor = xrRowTemplate.Cells.BackColor;
        xrcell.Height = xrRowTemplate.Height;
        if (i != 0)
        {
         xrcell.Location = new Point(Convert.ToInt32(Xmargin + xrRowTemplate.Cells.WidthF), 0);
        }
        else
        {
         xrcell.Location = new Point(0, 0);
        }
        xrRow.Cells.Add(xrcell);
       }
      }
      private void XR_HT_RT_FillEmptySpace(object sender, BandEventArgs e)
      {
       XRTable table = tableDetail;//Template Detail Band XRTable
       int iheight = table.Rows[table.Rows.Count - 1].Height;
       XRTable xrTable = new XRTable();
       xrTable.Size = new Size(table.Width, e.Band.Height - 1);
       xrTable.BorderWidth = table.BorderWidth;
       xrTable.Location = table.Location;
       xrTable.BackColor = table.BackColor;
       int SpaceRowCount = e.Band.Height / iheight;
       XRTableRow[] xrRow = new XRTableRow[SpaceRowCount];
       if (SpaceRowCount > 0)
       {
        for (int i = 0; i < SpaceRowCount; i++)
        {
         xrRow = new XRTableRow();
         xrRow.Size = new Size(table.Width, iheight);
         xrRow.Location = new Point(table.Location.X, i * iheight);
         xrRow.Borders = (DevExpress.XtraPrinting.BorderSide)((BorderSide.Left | BorderSide.Right) | BorderSide.Bottom);
         xrRow.BorderWidth = 1;
         xrRow.BorderColor = table.Rows[table.Rows.Count - 1].BorderColor;
         //CreateCell
         XRTableRow row = table.Rows[table.Rows.Count - 1];
         CreateCellArray(xrRow, row);
        }
        xrTable.Rows.AddRange(xrRow);
        e.Band.Controls.Add(xrTable);
       }
      }
    

      

  • 相关阅读:
    JVM内存逃逸
    SQL中游标的使用
    配置JAVA环境变量中CLASSPATH变量的作用
    什么是单点登录?单点登录的三种实现方式
    oracle中 connect by prior 递归算法
    test
    mac idea 常见错误记录
    mac 常用操作命令记录
    mac idea 常用快捷键记录
    运行maven install命令时出现错误(BUILD FAILURE)
  • 原文地址:https://www.cnblogs.com/ddlzq/p/4181393.html
Copyright © 2011-2022 走看看