zoukankan      html  css  js  c++  java
  • 动态创建报表笔记

    一、 新建XtraForm(可增加printBarManager1打印控件)

    二、引用类using DevExpress.XtraReports.UI;//使用报表属性需要用到该类

    //实例化打印报表
     public Reports.XtraReport_ZD rpt = new Reports.XtraReport_ZD();

    三、首先在XtraReportBase.Bands属性中添加Bands(添加带区)

    ReportHeaderBand header = new ReportHeaderBand();//表头(一次)
     //把带区加到报表中
    rpt.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { detail, header, pagefood, topM, ghBand });

    四、 在相应的Bands的XRControl.Controls属性中添加控件(往相应的带区添加控件)

    //新增控件,设定控件的属性
    XRLabel xlabRH = new XRLabel();
    xlabRH.Text = "表头";
    xlabRH.BackColor = Color.SeaGreen;
    xlabRH.Font = new Font(new System.Drawing.FontFamily("宋体"), 20, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
     xlabRH.Size = new Size(200, 42);//设置控件大小
    xlabRH.LocationF = new System.Drawing.Point(100, 500);
    //把控件添加到带区
    rpt.Bands[BandKind.ReportHeader].Controls.Add(xlabRH);
    View Code

    五、绑定数据

    rpt.DataSource = FillDataset();//设置报表数据源 
    rpt.DataMember = ((DataSet)rpt.DataSource).Tables[0].TableName;
    //给相应的控件赋值
    ..........
    //打开报表
    rpt.ShowPreviewDialog();
  • 相关阅读:
    Oracle DG备库强制switch_over过程
    Oracle硬解析,软解析,软软解析介绍
    在SQLPLUS里显示IP、用户名和实例名
    mysql-xtrabackup
    oracle external密码验证
    DBMS_MONITOR程序开启10046事件
    css样式
    PS中会使用到的快捷键有那些?
    CSS中的绝对定位与相对定位
    制作网页过程中,经常用到的代码
  • 原文地址:https://www.cnblogs.com/Garden-blog/p/3191338.html
Copyright © 2011-2022 走看看