lg
2024-09-10 f5907dab0137d9cfb610ef01b09592832e5aecb9
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace Gs.DevApp.DevFrm.Rpt
{
    public partial class RptUser : DevExpress.XtraEditors.XtraForm
    {
        public RptUser()
        {
            InitializeComponent();
            DataSet ds = new DataSet();
            DataTable table1 = new DataTable();
            table1.TableName = "Table1"; // 一定要设置表名称
            ds.Tables.Add(table1);
            // 添加表中的列
            table1.Columns.Add("姓名", typeof(string));
            table1.Columns.Add("密码", typeof(string));
            // 任意添加一些数据
            for (int i = 0, maxI = 100; i < maxI; i++)
            {
                DataRow row = table1.NewRow();
                row["姓名"] = "我是" + i.ToString();
                row["密码"] = i.ToString();
                table1.Rows.Add(row);
            }
            FastReport.Report report = new FastReport.Report();
            report.Load("templeEasyCode/Untitled.frx");//bin/debug下
            report.RegisterData(ds);//必须装 dataset 数据集,如果装入datatable数据表,要加参数表名,所以加集方便
            report.Preview = previewControl1;
            report.Prepare();
            report.ShowPrepared();
        }
    }
}