This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.cs
43 lines (38 loc) · 1.51 KB
/
Form1.cs
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
43
using System;
using System.Data;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;
// ...
namespace dxKB17175 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void simpleButton2_Click(object sender, EventArgs e) {
XtraReport1 report = new XtraReport1(checkEdit1.Checked ? FillDatasetFromGrid() : nwindDataSet, gridView1);
ReportPrintTool printTool = new ReportPrintTool(report);
printTool.ShowPreviewDialog();
}
private DataSet FillDatasetFromGrid() {
nwindDataSet ds = new nwindDataSet();
int rowHandle;
DataRow gridRow;
for (int i = 0; i < gridView1.RowCount; i++) {
rowHandle = gridView1.GetVisibleRowHandle(i);
if (!gridView1.IsGroupRow(rowHandle)) {
gridRow = gridView1.GetDataRow(rowHandle);
ds.Tables[0].Rows.Add(gridRow.ItemArray);
}
}
return ds;
}
private void Form1_Load(object sender, EventArgs e) {
this.customersTableAdapter.Fill(this.nwindDataSet.Customers);
}
private void simpleButton1_Click(object sender, EventArgs e) {
XtraReport1 report = new XtraReport1(checkEdit1.Checked ? FillDatasetFromGrid() : nwindDataSet, gridView1);
ReportDesignTool designTool = new ReportDesignTool(report);
designTool.ShowDesignerDialog();
}
}
}