private void simpleButton1_Click(object sender, EventArgs e)
        {
            XtraReport   report  = new XtraReport();
            NwindDataSet dataSet = FillDataSet();

            report.DataSource = dataSet;
            report.DataMember = dataSet.Customers.TableName;

            CreateReportHeader(report, "Runtime Generated Customer-Orders report", Color.PowderBlue, 32);
            CreateDetailBand(report, dataSet.Customers, "Customers", Color.Silver, false);
            CreateGrouping(report);

            switch (radioGroup1.SelectedIndex)
            {
            case 0:
                CreateDetailReportBasedOnSubreport(report);
                break;

            case 1:
                CreateDetailReportBasedOnDetailReportBand(report);
                break;
            }

            report.ShowPreviewDialog();
        }
Пример #2
0
 private void btnInKetQua_Click(object sender, EventArgs e)
 {
     if (trangthai.Equals("toanbo"))
     {
         if (gridViewTKPhatTu.RowCount > 0)
         {
             XtraReport rp = new XtraReport();
             rp.DataSource = gridTKPhatTu.DataSource;
             //rp.LoadLayout(Application.StartupPath + @"\ReportMauPhatTu.repx");
             rp.LoadLayout(Application.StartupPath + @"\ReportPhatTuTheoToanBoNgay.repx");
             //rp.ShowDesignerDialog();
             rp.ShowPreviewDialog();
         }
         else
         {
             XtraMessageBox.Show("Không có dữ liệu thống kê!");
         }
     }
     if (trangthai.Equals("tungngay"))
     {
         if (gridViewTKPhatTu.RowCount > 0)
         {
             XtraReport rp = new XtraReport();
             rp.DataSource = gridTKPhatTu.DataSource;
             rp.LoadLayout(Application.StartupPath + @"\ReportPhatTuTheoTungNgay.repx");
             //rp.ShowDesignerDialog();
             rp.ShowPreviewDialog();
         }
         else
         {
             XtraMessageBox.Show("Không có dữ liệu thống kê!");
         }
     }
     ConTKPhatTuNgay_Load(sender, e);
 }
 private void btnIn_Click(object sender, EventArgs e)
 {
     if (gvDanhSachThongKe.RowCount > 0)
     {
         XtraReport rp = new XtraReport();
         rp.DataSource = frm.ChuyenGridViewSangDataTable(gvDanhSachThongKe);
         //rp.ShowDesignerDialog();
         if (kiemTra == 1)
         {
             rp.LoadLayout(Application.StartupPath + @"\ReportThongKeXeMayHomNay.repx");
         }
         else if (kiemTra == 2)
         {
             rp.LoadLayout(Application.StartupPath + @"\ReportThongKePhuTungHomNay.repx");
         }
         else if (kiemTra == 3)
         {
             rp.LoadLayout(Application.StartupPath + @"\ReportThongKeXeMayNgayBatKy.repx");
         }
         else if (kiemTra == 4)
         {
             rp.LoadLayout(Application.StartupPath + @"\ReportThongKePhuTungNgayBatKy.repx");
         }
         //if (textBox1.Text == "1") rp.ShowDesignerDialog();
         //else rp.ShowPreviewDialog();
         rp.ShowPreviewDialog();
     }
     else
     {
         XtraMessageBox.Show("Không có dữ liệu để in", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Пример #4
0
        protected void OnPrintPreviewAndCreateReport(ColumnView view, object source, string repxFileName)
        {
            string path = Application.StartupPath + "\\Reports";

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            string     repx = path + "\\" + repxFileName;
            XtraReport r    = new XtraReport();

            r.DataSource = source;
            if (File.Exists(repx))
            {
                r.LoadLayout(repx);
                r.ShowPreviewDialog();
                //r.ShowDesignerDialog();
                return;
            }
            else
            {
                view.CreateReportTemplate(this.Text, false, false, System.Drawing.Printing.PaperKind.A4, true);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            // Create a report instance.
            var report = new XtraReport();

            // Set up the report's data source.
            report.DataSource = CreateDataSet();
            report.DataMember = (report.DataSource as DataSet).Tables[0].TableName;

            // Create bands.
            CreateBands(report);

            // Apply styles.
            ApplyStyles(report);

            // Add controls to the bands and bind the controls to data.
            if (xrTableRadioButton.Checked)
            {
                // Use the XRTable control to display data.
                InitializeBandsUsingXRTable(report);
            }
            else
            {
                // Use the XRLabel control to display data.
                InitializeBandsUsingXRLabel(report);
            };

            // Create a chart, bind it to data, and add the chart to the report.
            InitializeChart(report);

            // Show the report's Preview.
            report.ShowPreviewDialog();
        }
        public static void ShowPreview(MemoryStream reportStream, DataSet ds)
        {
            if (reportStream == null)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("报表模板未设置。");
                return;
            }

            XtraReport report = new XtraReport
            {
                DisplayName = "Report"
            };

            try
            {
                report.LoadLayout(reportStream);
            }
            catch
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("报表模板不正确,请重新设置报表模板");
                return;
            }

            report.DataSource = ds;

            report.ShowPreviewDialog();
        }
 private void btnIn_Click(object sender, EventArgs e)
 {
     if (gvDanhSachThongKe.RowCount > 0)
     {
         XtraReport rp = new XtraReport();
         rp.DataSource = frm.ChuyenGridViewSangDataTable(gvDanhSachThongKe);
         //rp.ShowDesignerDialog();
         if (lueChonLoaiThongKe.Text == "Xe máy")
         {
             rp.LoadLayout(Application.StartupPath + @"\ReportThongKeNhapXeMayTheoNam.repx");
         }
         else
         {
             rp.LoadLayout(Application.StartupPath + @"\ReportThongKeNhapPhuTungTheoNam.repx");
         }
         //if (textBox1.Text == "1")
         // rp.ShowDesignerDialog();
         //else rp.ShowPreviewDialog();
         rp.ShowPreviewDialog();
     }
     else
     {
         XtraMessageBox.Show("Không có dữ liệu để in", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
        public static void xtraReportView(string pathXtraReport, DataTable dataSourceXtraReport = null, Dictionary <string, object> param = null, string dataMemberXtraReport = null)
        {
            XtraReport report = new XtraReport();

            report = XtraReport.FromFile(Application.StartupPath + @"\Report\" + pathXtraReport + ".repx", true);
            if (dataSourceXtraReport != null)
            {
                report.DataSource = dataSourceXtraReport;
            }
            if (param != null)
            {
                foreach (string key in param.Keys)
                {
                    report.Parameters[key].Value = param[key];
                }
            }
            if (dataMemberXtraReport != null)
            {
                report.DataMember = dataMemberXtraReport;
            }
            else
            {
                report.DataMember = "ValidDataMember";
            }
            report.ShowPreviewDialog();
        }
Пример #9
0
        private void btnInKetQua_Click(object sender, EventArgs e)
        {
            if (trangthai.Equals("toanbo"))
            {
                XtraReport rp = new XtraReport();
                rp.DataSource = gridTKNguoiO.DataSource;
                rp.LoadLayout(Application.StartupPath + @"\ReportTKNguoiNuoiToanBoNam.repx");
                //rp.ShowDesignerDialog();
                rp.ShowPreviewDialog();
            }
            if (trangthai.Equals("tungnam"))
            {
                XtraReport rp = new XtraReport();
                rp.DataSource = gridTKNguoiO.DataSource;
                rp.LoadLayout(Application.StartupPath + @"\ReportTKNguoiNuoiToanBoNamTheoNhom.repx");
                //rp.ShowDesignerDialog();
                rp.ShowPreviewDialog();
            }

            //Thống kê theo nhiều năm
            if (trangthai.Equals("motnamtoanbo"))
            {
                XtraReport rp = new XtraReport();
                rp.DataSource = gridTKNguoiO.DataSource;
                rp.LoadLayout(Application.StartupPath + @"\ReportTKNguoiNuoiToanBoMotNam.repx");
                //rp.ShowDesignerDialog();
                rp.ShowPreviewDialog();
            }

            if (trangthai.Equals("motnamtungthang"))
            {
                XtraReport rp = new XtraReport();
                rp.DataSource = gridTKNguoiO.DataSource;
                rp.LoadLayout(Application.StartupPath + @"\ReportTKNguoiNuoiMotNamTheoThang.repx");
                //rp.ShowDesignerDialog();
                rp.ShowPreviewDialog();
            }

            if (trangthai.Equals("nhieunamtoanbo"))
            {
                XtraReport rp = new XtraReport();
                rp.DataSource = gridTKNguoiO.DataSource;
                rp.LoadLayout(Application.StartupPath + @"\ReportTKNguoiNuoiNhieuNamToanBo.repx");
                //rp.ShowDesignerDialog();
                rp.ShowPreviewDialog();
            }
            if (trangthai.Equals("nhieunamtungnam"))
            {
                XtraReport rp = new XtraReport();
                rp.DataSource = gridTKNguoiO.DataSource;
                rp.LoadLayout(Application.StartupPath + @"\ReportTKNguoiNuoiNhieuNamTungNam.repx");
                //rp.ShowDesignerDialog();
                rp.ShowPreviewDialog();
            }


            ConTKNguoiNam_Load(sender, e);
        }
        void InHangDangChon(object sender, EventArgs e)
        {
            XtraReport rp = new XtraReport();

            rp.DataSource = hdbptControl.getAllDataPrint(gvHoaDon.GetRowCellValue(gvHoaDon.FocusedRowHandle, "MAHDBANPT").ToString());
            //rp.ShowDesignerDialog();
            rp.LoadLayout(Application.StartupPath + @"\ReportHoaDonBanPhuTung.repx");
            // rp.ShowDesignerDialog();
            rp.ShowPreviewDialog();
        }
Пример #11
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            XtraReport rp = new XtraReport();

            rp.DataSource = nvControl.getAllData();
            // rp.ShowDesignerDialog();
            rp.LoadLayout(Application.StartupPath + @"\ReportDanhSachNhanVien.repx");
            rp.ShowPreviewDialog();
            //rp.ShowDesignerDialog();
        }
Пример #12
0
        public ReportPreviewForm(XtraReport xtr)
        {
            InitializeComponent();
            this.xtr = xtr;

            using (ReportPrintTool pTool = new ReportPrintTool(xtr))
            {
                xtr.ShowPreviewDialog();
            }
        }
        private void buttonPreview_Click(object sender, EventArgs e)
        {
            // Show a preview for a selected report.
            XtraReport report = GetSelectedReport();

            if (report != null)
            {
                report.ShowPreviewDialog();
            }
        }
Пример #14
0
        void GiderYazdir(bool Disigner)
        {
            try
            {
                System.Data.DataSet ds      = new DataSet("Test");
                DataTable           dtliste = (DataTable)gcGiderler.DataSource;

                dtliste.TableName = "dtliste";
                ds.Tables.Add(dtliste);
                //şirket bilgileri
                DataTable Sirket = DB.GetData(@"select * from Sirketler with(nolock)");
                Sirket.TableName = "Sirket";
                ds.Tables.Add(Sirket);

                string exedizini = Path.GetDirectoryName(Application.ExecutablePath);

                string RaporDosyasi = exedizini + "\\Raporlar\\Giderler.repx";
                if (!File.Exists(RaporDosyasi))
                {
                    MessageBox.Show("Giderler.repx Dosya Bulunamadı");
                    return;
                }
                XtraReport rapor = new XtraReport();

                rapor.LoadLayout(RaporDosyasi);
                rapor.FindControl("label3", true).Text = deBasGelir.Text + "         " + deBitGelir.Text;

                rapor.Name = "Giderler";

                rapor.Report.Name = "Giderler";

                rapor.DataSource = ds;

                if (Disigner)
                {
                    rapor.ShowDesignerDialog();
                }
                else
                {
                    rapor.ShowPreviewDialog();
                }
                //ds.Dispose();
                ds.Tables.Remove(dtliste);
                ds.Tables.Remove(Sirket);


                dtliste.Dispose();
                ds.Dispose();
                rapor.Dispose();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Hata Oluştu " + exp.Message);
            }
        }
        private void btnPrint_Click(object sender, EventArgs e)
        {
            XtraReport rp = new XtraReport();

            rp.DataSource = ptControl.danhSachPhuTungCoTrongCuaHang();
            //rp.ShowDesignerDialog();
            rp.LoadLayout(Application.StartupPath + @"\ReportDanhSachPhuTungTrongCuaHang.repx");
            //if(textBox1.Text == "1") rp.ShowPreviewDialog();
            //rp.ShowDesignerDialog();
            rp.ShowPreviewDialog();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            List <MyComplexObject> l = GenerateRecords();

            using (XtraReport r = new XtraReport()) {
                r.Landscape = true;
                ReportBuilderHelper rbh = new ReportBuilderHelper();
                rbh.GenerateReport(r, l);
                r.ShowPreviewDialog();
            }
        }
Пример #17
0
        private void printOut_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            String     currentOid = "";
            ReportData reportdata = ObjectSpace.FindObject <ReportData>(new BinaryOperator("Name", String.Format("{0}PrintOut", View.ObjectType.Name)));
            XtraReport xr         = reportdata.LoadXtraReport(ObjectSpace);

            currentOid = (((DetailView)View).CurrentObject.ToString().Remove(0,
                                                                             (((DetailView)View).CurrentObject.ToString().Length) - 38));
            currentOid      = currentOid.Replace("(", "{");
            currentOid      = currentOid.Replace(")", "}");
            xr.FilterString = String.Format("[Oid] = {0}", currentOid);
            xr.ShowPreviewDialog();
        }
 private void btnIn_Click(object sender, EventArgs e)
 {
     if (trangthai.Equals("toanbo"))
     {
         if (gridViewTKChiTieu.RowCount > 0)
         {
             XtraReport rp = new XtraReport();
             rp.DataSource = gridTKChiTieu.DataSource;
             rp.LoadLayout(Application.StartupPath + @"\ReportTKChiTietToanBoThang.repx");
             //rp.ShowDesignerDialog();
             rp.ShowPreviewDialog();
         }
         else
         {
             XtraMessageBox.Show("Không có dữ liệu để in!");
         }
     }
     if (trangthai.Equals("toanbomotthang"))
     {
         if (gridViewTKChiTieu.RowCount > 0)
         {
             XtraReport rp = new XtraReport();
             rp.DataSource = gridTKChiTieu.DataSource;
             rp.LoadLayout(Application.StartupPath + @"\ReportTKChiTieuToanBoMotThang.repx");
             //rp.ShowDesignerDialog();
             rp.ShowPreviewDialog();
         }
         else
         {
             XtraMessageBox.Show("Không có dữ liệu để in!");
         }
     }
     if (trangthai.Equals("tungngaymotthang"))
     {
         if (gridViewTKChiTieu.RowCount > 0)
         {
             XtraReport rp = new XtraReport();
             rp.DataSource = gridTKChiTieu.DataSource;
             rp.LoadLayout(Application.StartupPath + @"\ReportTKChiTietTungNgayMotThang.repx");
             //rp.ShowDesignerDialog();
             rp.ShowPreviewDialog();
         }
         else
         {
             XtraMessageBox.Show("Không có dữ liệu để in!");
         }
     }
     ConTKChiTieuThang_Load(sender, e);
 }
Пример #19
0
 private void btnIn_Click(object sender, EventArgs e)
 {
     ConTKNguoiOThang_Load(sender, e);
     if (trangthai.Equals("nhieuthang"))
     {
         if (gridViewTKNguoiThang.RowCount > 0)
         {
             XtraReport rp = new XtraReport();
             rp.DataSource = gridTKNguoiThang.DataSource;
             rp.LoadLayout(Application.StartupPath + @"\ReportTKNguoiNuoiTungThang.repx");
             //rp.ShowDesignerDialog();
             rp.ShowPreviewDialog();
         }
         else
         {
             XtraMessageBox.Show("Không có dữ liệu để in", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     if (trangthai.Equals("nhieungay"))
     {
         if (gridViewTKNguoiThang.RowCount > 0)
         {
             XtraReport rp = new XtraReport();
             rp.DataSource = gridTKNguoiThang.DataSource;
             rp.LoadLayout(Application.StartupPath + @"\ReportTKNguoiNuoiMotThangToanBo.repx");
             //rp.ShowDesignerDialog();
             rp.ShowPreviewDialog();
         }
         else
         {
             XtraMessageBox.Show("Không có dữ liệu để in", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     if (trangthai.Equals("motngay"))
     {
         if (gridViewTKNguoiThang.RowCount > 0)
         {
             XtraReport rp = new XtraReport();
             rp.DataSource = gridTKNguoiThang.DataSource;
             rp.LoadLayout(Application.StartupPath + @"\ReportTKNguoiNuoiMotThangMotNgay.repx");
             //rp.ShowDesignerDialog();
             rp.ShowPreviewDialog();
         }
         else
         {
             XtraMessageBox.Show("Không có dữ liệu để in", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
Пример #20
0
 private void btnIn_Click(object sender, EventArgs e)
 {
     if (gridVPhongO.RowCount > 0)
     {
         XtraReport rp = new XtraReport();
         rp.DataSource = gridVPhongO.DataSource;
         rp.LoadLayout(Application.StartupPath + @"\ReportCapNhatPhong.repx");
         //rp.ShowDesignerDialog();
         rp.ShowPreviewDialog();
     }
     else
     {
         XtraMessageBox.Show("Không có dữ liệu để in", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
 private void btnIn_Click(object sender, EventArgs e)
 {
     if (gridViewTienTuThien.RowCount > 0)
     {
         XtraReport rp = new XtraReport();
         rp.DataSource = gridTienTuThien.DataSource;
         rp.LoadLayout(Application.StartupPath + @"\ReportInTienChiTieu.repx");
         //rp.ShowDesignerDialog();
         rp.ShowPreviewDialog();
     }
     else
     {
         XtraMessageBox.Show("Không có dữ liệu để in!");
     }
     InchiTieuHangNgay_Load(sender, e);
 }
Пример #22
0
 private void btnIn_Click(object sender, EventArgs e)
 {
     if (gridViewLichLamViec.RowCount > 0)
     {
         XtraReport rp = new XtraReport();
         rp.DataSource = gridLichLamViec.DataSource;
         rp.LoadLayout(Application.StartupPath + @"\ReportInLichLamViecTheoTieuChi.repx");
         //rp.ShowDesignerDialog();
         rp.ShowPreviewDialog();
     }
     else
     {
         XtraMessageBox.Show("Không có dữ liệu để in!");
     }
     InLichLamViec_Load(sender, e);
 }
Пример #23
0
 private void btnTungNgay_Click(object sender, EventArgs e)
 {
     if (gridViewTKNguoiDuocNuoi.RowCount > 0)
     {
         XtraReport rp = new XtraReport();
         rp.DataSource = gridTKNguoiDuocNuoi.DataSource;
         rp.LoadLayout(Application.StartupPath + @"\ReportTKNguoiNuoiTungNgay.repx");
         //rp.ShowDesignerDialog();
         rp.ShowPreviewDialog();
     }
     else
     {
         XtraMessageBox.Show("Không có dữ liệu để in", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     ConTKNguoiONgay_Load(sender, e);
 }
Пример #24
0
 private void btnIn_Click(object sender, EventArgs e)
 {
     if (gridViewNguoiO.RowCount > 0)
     {
         XtraReport rp = new XtraReport();
         rp.DataSource = gridNguoiO.DataSource;;;
         rp.LoadLayout(Application.StartupPath + @"\ReportInPhongOToanBo.repx");
         //rp.ShowDesignerDialog();
         rp.ShowPreviewDialog();
     }
     else
     {
         XtraMessageBox.Show("Không có dữ liệu để thống kê!");
     }
     InPhongO_Load(sender, e);
 }
Пример #25
0
 private void btnIn_Click(object sender, EventArgs e)
 {
     if (gridViewTaiKhoan.RowCount > 0)
     {
         XtraReport rp = new XtraReport();
         rp.DataSource = gridTaiKhoan.DataSource;
         rp.LoadLayout(Application.StartupPath + @"\ReportTaiKhoanTheoQuyen.repx");
         //rp.ShowDesignerDialog();
         rp.ShowPreviewDialog();
     }
     else
     {
         XtraMessageBox.Show("Không có dữ liệu để thống kê!");
     }
     InTaiKhoan_Load(sender, e);
 }
Пример #26
0
 private void btnInToanBo_Click(object sender, EventArgs e)
 {
     gridLichViengTham.DataSource = viengtham.InToanBoLich();
     if (gridViewLichViengTham.RowCount > 0)
     {
         XtraReport rp = new XtraReport();
         rp.DataSource = gridLichViengTham.DataSource;;
         rp.LoadLayout(Application.StartupPath + @"\ReportInLichViengThamToanBo.repx");
         //rp.ShowDesignerDialog();
         rp.ShowPreviewDialog();
     }
     else
     {
         XtraMessageBox.Show("Không có dữ liệu để thống kê!");
     }
     InLichViengTham_Load(sender, e);
 }
Пример #27
0
 private void btnInToanBo_Click(object sender, EventArgs e)
 {
     gridPhatTu.DataSource = phattu.AllDataPhatTu();
     if (gridViewPhatTu.RowCount > 0)
     {
         XtraReport rp = new XtraReport();
         rp.DataSource = gridPhatTu.DataSource;
         rp.LoadLayout(Application.StartupPath + @"\ReportInPhatTuToanBo.repx");
         //rp.ShowDesignerDialog();
         rp.ShowPreviewDialog();
     }
     else
     {
         XtraMessageBox.Show("Không có dữ liệu để thống kê!");
     }
     InPhatTu_Load(sender, e);
 }
Пример #28
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var check = this.Manager.SaveInvoice(this.Manager.ActiveModel);

            if (check.Failed)
            {
                Mess.Info(check.Message);
                this.TryShowPopup(check.Property);
                return;
            }

            XtraReport report = this.Manager.PrintInvoice(this.Manager.ActiveModel.InvoiceID);

            report.ShowPreviewDialog();

            this.DialogResult = System.Windows.Forms.DialogResult.Yes;
            this.Close();
        }
Пример #29
0
        private void btnIn_Click(object sender, EventArgs e)
        {
            var mahdban = gvDanhSachHoaDonBanXe.GetRowCellValue(gvDanhSachHoaDonBanXe.FocusedRowHandle, "MAHDBAN");

            if (mahdban != null)
            {
                XtraReport rp = new XtraReport();
                rp.DataSource = hdBanXeControl.inHoaDon(mahdban.ToString().Trim());

                rp.LoadLayout(Application.StartupPath + @"\ReportHoaDonBanXeMay.repx");
                //if (textEdit1.Text == "1") rp.ShowDesignerDialog();
                //else rp.ShowPreviewDialog();
                rp.ShowPreviewDialog();
            }
            else
            {
                XtraMessageBox.Show("Bạn chưa chọn đối tượng cần in", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #30
0
        private void btnIn_Click(object sender, EventArgs e)
        {
            int HangDangChon = gvDanhSachNhapPhuTung.FocusedRowHandle;
            var maNhapPT     = gvDanhSachNhapPhuTung.GetRowCellValue(HangDangChon, "MANPT");

            if (maNhapPT != null)
            {
                XtraReport rp = new XtraReport();
                rp.DataSource = nhapPTControl.getAllDataPrint((maNhapPT as string).Trim());
                //rp.ShowDesignerDialog();
                rp.LoadLayout(Application.StartupPath + @"\ReportHoaDonNhapPhuTung.repx");
                //rp.ShowDesignerDialog();
                rp.ShowPreviewDialog();
            }
            else
            {
                XtraMessageBox.Show("Bạn chưa chọn đối tượng cần in ấn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #31
0
        private void iBaoCao_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            XtraReport r = new XtraReport();
            r.Landscape = true;

            ReportBuilderHelper rbh = new ReportBuilderHelper();
            if(ReportList == null) { MessageBox.Show("Chọn danh sách đã!"); return; }
            rbh.Header = "Danh sách " + CurrentMDI.GetName();
            rbh.GenerateReport(r, ReportList, CurrentMDI.GetType());
            r.ShowPreviewDialog();
        }
Пример #32
0
        //http://documentation.devexpress.com/#corelibraries/clsDevExpressXtraPrintingProgressReflectortopic
        public static void ShowPreview(XtraReport report)
        {
            // Create a form to show a progress bar,
            // and adjust its properties.
            Form form = new Form();
            form.FormBorderStyle = FormBorderStyle.None;
            form.Size = new System.Drawing.Size(300, 25);
            form.ShowInTaskbar = false;
            form.StartPosition = FormStartPosition.CenterScreen;
            form.TopMost = true;

            // Create a ProgressBar along with its ReflectorBar.
            ProgressBarControl progressBar = new ProgressBarControl();
            ReflectorBar reflectorBar = new ReflectorBar(progressBar);

            // Add a progress bar to a form and show it.
            form.Controls.Add(progressBar);
            progressBar.Dock = DockStyle.Fill;
            form.Show();

            try
            {
                // Register the reflector bar, so that it reflects
                // the state of a ProgressReflector.
                report.PrintingSystem.ProgressReflector = reflectorBar;
                report.CreateDocument();
            }
            finally
            {
                // Unregister the reflector bar, so that it no longer
                // reflects the state of a ProgressReflector.
                report.PrintingSystem.ResetProgressReflector();
                form.Close();
                form.Dispose();
            }

            // Show the preview of the created document.
            report.ShowPreviewDialog();
        }
Пример #33
0
        /// <summary>
        /// 显示打印预览
        /// </summary>
        /// <param name="reportClass">报表类</param>
        /// <param name="data">填充数据</param>
        /// <param name="tableName">填充的数据表名称</param>
        public static void ShowPreview(XtraReport reportClass, DataSet data, string tableName)
        {
            if (reportClass == null) return;
            //如果包含填充数据则将数据绑定到报表
            reportClass.DataSource = data;
            reportClass.DataMember = tableName;
            reportClass.PrinterName = GetDefaultPrinter();
            reportClass.PrintingSystem.ShowMarginsWarning = false;

            //#region 直接打印
            //for (int i = 0; i < 2; i++)
            //{
            //    reportClass.PaperKind = System.Drawing.Printing.PaperKind.Custom;
            //    reportClass.Print();
            //}
            //#endregion
            reportClass.ShowPreviewDialog();
        }