zoukankan      html  css  js  c++  java
  • [DevExpress使用随笔]之预览repx报表(转)

    来自:http://blog.csdn.net/HXC_HUANG/article/details/78181962?locationNum=9&fps=1

    [DevExpress使用随笔]之RibbonReportDesigner控件 中我们生成了Winform报表设计器和管理控件程序,并利用该程序生成了后缀为repx的报表文件,那么如何在项目中预览并打印repx报表呢?

    一、首先新建一个Form,并将工具栏中的DocumentView拖入Form中。 这里写图片描述 二、添加如下的代码:

        public partial class Form1 : Form
        {
            string FileSaveFilePath = "XtraReport.repx";
            XtraReport report = null;
            public Form1()
            {
                InitializeComponent();
                report = new XtraReport();
                InitReport();
            }
            private void InitReport()
            {
                if (File.Exists(FileSaveFilePath))
                {
                    report.LoadLayout(FileSaveFilePath);
                }
                else
                {
                    MessageBox.Show("报表文件不存在");
                    return;
                }
                documentViewer1.DocumentSource = report;
                report.CreateDocument();
            }
        }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    三、这样生成项目后,就可以在窗口中预览repx报表了。 这里写图片描述 四、为了更好地对预览的报表进行打印等操作,Document Viewers还可以自动创建Ribbon Toolbar或Standard Toolbar: 这里写图片描述 五、这样,控件就自动为你生成了带有Ribbon Toolbar的报表显示界面。 这里写图片描述 六、Ribbon Toolbar提供了报表操作的几乎所有功能,使用非常方便。 七、这样,利用这RibbonReportDesigner和Document Viewers这两个控件,就可以在项目中实现报表的独立制作和动态调用。

  • 相关阅读:
    IDEA安装步骤
    记录常用网站
    IDEA解决中文乱码问题
    使用IDEA 中 实现springboot 热部署 (spring boot devtools版)
    Springboot学习
    写文档步骤
    some untracked working tree files问题解决
    利用mybatis-generator自动生成代码
    Java实现打印功能
    sql语句大全
  • 原文地址:https://www.cnblogs.com/gisoracle/p/8469759.html
Copyright © 2011-2022 走看看