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

      

  • 相关阅读:
    添加或删除项并动态记录项的值
    练习题。对DOM中document的深刻理解巩固
    document--文档中的操作,操作属性、操作样式、操作元素
    10.13DOM中document--文档1找到元素的方法,还有元素内容属性
    函数的定义,语法,二维数组,几个练习题
    10.11讲的内容总结
    js基础巩固练习
    10.9做的一个静态页面(巩固前面的内容)
    9.29学习的js基础
    9.28做的作业(企业名称静态网页)
  • 原文地址:https://www.cnblogs.com/ddlzq/p/4181393.html
Copyright © 2011-2022 走看看