private void exportToolStripMenuItem_Click(object sender, EventArgs e) { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = gridControl1; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.Landscape = false; link.Margins.Left = 50; link.Margins.Right = 50; link.Margins.Top = 50; link.Margins.Bottom = 50; var Font = new Font("Tahoma", 12, FontStyle.Bold); PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; string mdlH = $"Ödeme Performans {dateEdit1.DateTime:dd.MM.yy} - {dateEdit2.DateTime:dd.MM.yy}"; phf.Header.Content.AddRange(new string[] { "", mdlH, "" }); phf.Header.LineAlignment = BrickAlignment.Far; phf.Header.Font = Font; phf.Footer.Content.AddRange(new string[] { "[Date Printed] [Time Printed]", "", Program.USR }); phf.Footer.LineAlignment = BrickAlignment.Near; link.CreateDocument(); link.ShowPreview(); }
private void cmdPrintList_Click(object sender, EventArgs e) { try { //gridControl1.ShowPrintPreview(); if (gridView1.SortInfo.Count > 0) { GridColumnSortInfo i = gridView1.SortInfo[0]; string sortType = "crescente"; if (i.SortOrder == DevExpress.Data.ColumnSortOrder.Descending) { sortType = "decrescente"; } orderBy = string.Format("ordinato per {0} {1}", i.Column.FieldName.ToLower(), sortType); } PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea); link.CreateMarginalFooterArea += new CreateAreaEventHandler(link_CreateMarginalFooterArea); link.Component = gridControl1; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.ShowPreview(); } catch (Exception ex) { ErrorHandler.Show(ex); } }
private void printToolStripMenuItem_Click(object sender, EventArgs e) { PrintingSystem ps = new PrintingSystem(); PrintableComponentLink link = new PrintableComponentLink(ps); link.Component = avdGridControl; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.Landscape = false; link.Margins.Left = 50; link.Margins.Right = 50; link.Margins.Top = 50; link.Margins.Bottom = 50; var Font = new Font("Tahoma", 12, FontStyle.Bold); PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; string reportHeader = string.Format("Muhasebe Fişi {0}, {1}, {2}", avbRow.AVBID, avbvGridControl.GetCellDisplayText(rowTUR, 0), avbvGridControl.GetCellDisplayText(rowTRH, 0)); phf.Header.Content.AddRange(new string[] { "", reportHeader, "" }); phf.Header.LineAlignment = BrickAlignment.Far; phf.Header.Font = Font; phf.Footer.Content.AddRange(new string[] { "[Date Printed] [Time Printed]", "", Program.USR }); phf.Footer.LineAlignment = BrickAlignment.Near; link.CreateDocument(); link.ShowPreview(); }
private void exportToolStripMenuItem_Click(object sender, EventArgs e) { PrintingSystem ps = new PrintingSystem(); PrintableComponentLink link = new PrintableComponentLink(ps); link.Component = mznDvzGridControl; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.Landscape = true; link.Margins.Left = 50; link.Margins.Right = 50; link.Margins.Top = 50; link.Margins.Bottom = 50; var Font = new Font("Tahoma", 12, FontStyle.Bold); PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; string mdlH = string.Format("MİZAN Dövizli {0:dd.MM.yy} - {1:dd.MM.yy}", dateEdit1.EditValue, dateEdit2.EditValue); phf.Header.Content.AddRange(new string[] { "", mdlH, "" }); phf.Header.LineAlignment = BrickAlignment.Far; phf.Header.Font = Font; phf.Footer.Content.AddRange(new string[] { "[Date Printed] [Time Printed]", "", Program.USR }); phf.Footer.LineAlignment = BrickAlignment.Near; link.CreateDocument(); link.ShowPreview(); }
private void exportToolStripMenuItem2_Click(object sender, EventArgs e) { DevExpress.Export.ExportSettings.DefaultExportType = DevExpress.Export.ExportType.DataAware; PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = pivotGridControl1; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.Landscape = true; link.Margins.Left = 50; link.Margins.Right = 50; link.Margins.Top = 50; link.Margins.Bottom = 50; var Font = new Font("Tahoma", 12, FontStyle.Bold); PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; string mdlH = string.Format("Müşteri Kalan Takibi TOPLAM"); phf.Header.Content.AddRange(new string[] { "", mdlH, "" }); phf.Header.LineAlignment = BrickAlignment.Far; phf.Header.Font = Font; phf.Footer.Content.AddRange(new string[] { "[Date Printed] [Time Printed]", "", Program.USR }); phf.Footer.LineAlignment = BrickAlignment.Near; link.CreateDocument(); link.ShowPreview(); }
private void exportToolStripMenuItem_Click(object sender, EventArgs e) { PrintingSystem ps = new PrintingSystem(); PrintableComponentLink link = new PrintableComponentLink(ps); link.Component = pPRDGridControl; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.Landscape = false; link.Margins.Left = 50; link.Margins.Right = 50; link.Margins.Top = 50; link.Margins.Bottom = 50; var Font = new Font("Tahoma", 12, FontStyle.Bold); PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; string mdlH = string.Format("BODVED OYUNCU LİSTESİ"); phf.Header.Content.AddRange(new string[] { "", mdlH, "" }); phf.Header.LineAlignment = BrickAlignment.Far; phf.Header.Font = Font; phf.Footer.Content.AddRange(new string[] { "[Date Printed] [Time Printed]", "masatenisi.online", "©Şener DEMİRAL" }); phf.Footer.LineAlignment = BrickAlignment.Near; link.CreateDocument(); link.ShowPreview(); }
private void exportToolStripMenuItem_Click(object sender, EventArgs e) { //if (!Program.MF.EntryCheck("Ops.Proje.Export", isSilent: true)) // return; PrintingSystem ps = new PrintingSystem(); PrintableComponentLink link = new PrintableComponentLink(ps); link.Component = prtGridControl; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.Landscape = true; link.Margins.Left = 50; link.Margins.Right = 50; link.Margins.Top = 50; link.Margins.Bottom = 50; var Font = new Font("Tahoma", 10, FontStyle.Bold); PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; phf.Header.Content.AddRange(new string[] { "", "Projeler", "" }); phf.Header.LineAlignment = BrickAlignment.Far; phf.Header.Font = Font; phf.Footer.Content.AddRange(new string[] { "[Date Printed] [Time Printed]", "", Program.USR }); phf.Footer.LineAlignment = BrickAlignment.Near; link.CreateDocument(); link.ShowPreview(); }
private void toolStripMenuItemPvtExport_Click(object sender, EventArgs e) { PrintingSystem ps = new PrintingSystem(); PrintableComponentLink link = new PrintableComponentLink(ps); link.Component = pivotGridControl1; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.Landscape = true; link.Margins.Left = 50; link.Margins.Right = 50; link.Margins.Top = 50; link.Margins.Bottom = 50; var Font = new Font("Tahoma", 12, FontStyle.Bold); PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; string mdlH = string.Format("KPI House"); phf.Header.Content.AddRange(new string[] { "", mdlH, "" }); phf.Header.LineAlignment = BrickAlignment.Far; phf.Header.Font = Font; phf.Footer.Content.AddRange(new string[] { "[Date Printed] [Time Printed]", "", Program.USR }); phf.Footer.LineAlignment = BrickAlignment.Near; link.CreateDocument(); link.ShowPreview(); }
private void exportToolStripMenuItem_Click(object sender, EventArgs e) { //opmaGridControl.ShowPrintPreview(); //return; PrintingSystem ps = new PrintingSystem(); // Create a link that will print a control. PrintableComponentLink link = new PrintableComponentLink(ps); // Specify the control to be printed. link.Component = opmaGridControl; // Set the paper format. link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.Landscape = true; link.Margins.Left = 50; link.Margins.Right = 50; link.Margins.Top = 50; link.Margins.Bottom = 50; // Subscribe to the CreateReportHeaderArea event used to generate the report header. //link.CreateMarginalHeaderArea += link_CreateMarginalHeaderArea; //link.CreateMarginalFooterArea += link_CreateMarginalFooterArea; // Generate the report. link.CreateDocument(); // Show the report. link.ShowPreview(); }
private void exportToolStripMenuItem1_Click(object sender, EventArgs e) { PrintingSystem ps = new PrintingSystem(); PrintableComponentLink link = new PrintableComponentLink(ps); link.Component = chargeGridControl; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.Landscape = true; link.Margins.Left = 50; link.Margins.Right = 50; link.Margins.Top = 50; link.Margins.Bottom = 50; var Font = new Font("Tahoma", 12, FontStyle.Bold); PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; phf.Header.Content.AddRange(new string[] { "", "FATURALANMAMIŞ CHARGE", "" }); phf.Header.LineAlignment = BrickAlignment.Far; phf.Header.Font = Font; phf.Footer.Content.AddRange(new string[] { "[Date Printed] [Time Printed]", "", "" }); phf.Footer.LineAlignment = BrickAlignment.Near; link.CreateDocument(); link.ShowPreview(); }
void m_cmd_xuat_pdf_Click(object sender, EventArgs e) { try { // Check whether the ChartControl can be previewed. if (!chartControl1.IsPrintingAvailable) { CHRM_BaseMessages.MsgBox_Error("The 'DevExpress.XtraPrinting' is not found"); return; } // Open the Preview window. PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = chartControl1; chartControl1.OptionsPrint.SizeMode = PrintSizeMode.Stretch; //chartControl1.Legend.MaxVerticalPercentage = 100; link.Landscape = true; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.ShowPreview(); // Specify the paper kind and page orientation. //chartControl1.Legend.MaxVerticalPercentage = 100; //chartControl1.Legend.Direction = DevExpress.XtraCharts.LegendDirection.TopToBottom; //chartControl1.ShowPrintPreview(DevExpress.XtraCharts.Printing.PrintSizeMode.Zoom); } catch (Exception v_e) { CSystemLog_301.ExceptionHandle(v_e); } }
private void exportToolStripMenuItem_Click(object sender, EventArgs e) { PrintingSystem ps = new PrintingSystem(); PrintableComponentLink link = new PrintableComponentLink(ps); link.Component = kkfGridControl; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.Landscape = true; link.Margins.Left = 50; link.Margins.Right = 50; link.Margins.Top = 50; link.Margins.Bottom = 50; var Font = new Font("Tahoma", 10, FontStyle.Bold); PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; phf.Header.Content.AddRange(new string[] { string.Format("[{0}] {1}", kkoID, kkoKonu), "", "Kalite Yönetim Faaliyet" }); phf.Header.LineAlignment = BrickAlignment.Far; phf.Header.Font = Font; phf.Footer.Content.AddRange(new string[] { "[Date Printed] [Time Printed]", "", Program.USR }); phf.Footer.LineAlignment = BrickAlignment.Near; link.CreateDocument(); link.ShowPreview(); }
private void simpleButton1_Click(object sender, EventArgs e) { //if (DevExpress.XtraPrinting.PrintHelper.IsPrintingAvailable) //{ PrintingSystem ps = new PrintingSystem(); PrintableComponentLink link = new PrintableComponentLink(ps); link.Component = orderGrid; link.Landscape = true; PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; phf.Header.Content.Clear(); phf.Header.Content.AddRange(new string[] { "", "订单明细列表", "" }); phf.Header.Font = new System.Drawing.Font("宋体", 16, System.Drawing.FontStyle.Regular); phf.Header.LineAlignment = BrickAlignment.Center; phf.Footer.Content.Clear(); phf.Footer.Content.AddRange(new string[] { "", String.Format("打印时间: {0:g}", DateTime.Now), "" }); link.CreateDocument(); link.ShowPreview(); //} //else //{ // XtraMessageBox.Show("打印机不可用...", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //} }
private void ShowCustomizePreview(IPrintable ctrl, bool isLanscape) { // Create a PrintingSystem component. PrintingSystem ps = new PrintingSystem(); // Create a link that will print a control. PrintableComponentLink Print = new PrintableComponentLink(ps); // Specify the control to be printed. Print.Component = ctrl; // Set the paper format. Print.PaperKind = System.Drawing.Printing.PaperKind.A4; Print.Landscape = isLanscape; Print.Margins = new System.Drawing.Printing.Margins(40, 40, 40, 40); string dbName = Config.GetValue("DbName").ToString(); if (dbName.Contains("DEMO")) { ps.Watermark.Text = "Hoa Tiêu Demo"; ps.Watermark.TextTransparency = 150; } // Subscribe to the CreateReportHeaderArea event used to generate the report header. Print.CreateReportHeaderArea += new CreateAreaEventHandler(Print_CreateReportHeaderArea); Print.CreateReportFooterArea += new CreateAreaEventHandler(Print_CreateReportFooterArea); // Generate the report. Print.CreateDocument(); // Show the report. Print.ShowPreview(); }
private void ShowDefaultReport(IPrintable e, bool isPrint) { PrintingSystem p = new PrintingSystem(); p.ShowMarginsWarning = false; p.PreviewFormEx.KeyUp += new KeyEventHandler(PreviewFormEx_KeyUp); PrintableComponentLink i = new PrintableComponentLink(p); i.CreateDocument(p); i.Component = e; i.Landscape = _data.DrTable["isLand"] == DBNull.Value || bool.Parse(_data.DrTable["isLand"].ToString()); i.PaperKind = PaperKind.A4; i.RtfReportFooter = "Tổng Cộng"; i.Margins = new System.Drawing.Printing.Margins(25, 25, 25, 25); i.CreateReportHeaderArea += new CreateAreaEventHandler(i_CreateReportHeaderArea); i.CreateReportFooterArea += new CreateAreaEventHandler(i_CreateReportFooterArea); gridViewReport.ColumnPanelRowHeight = 30; gridViewReport.OptionsPrint.UsePrintStyles = true; i.CreateDocument(); i.ShowPreview(this.gridControlReport.LookAndFeel); }
private void barPrint_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()) { Component = this.gridControl1, Landscape = true, PaperKind = System.Drawing.Printing.PaperKind.A3 }; link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea); link.CreateDocument(); link.ShowPreview(); }
private void btnYazdir_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); (gridContStokHareket.MainView as GridView).Columns["FisKodu"].Visible = false; (gridContStokHareket.MainView as GridView).Columns["Tarih"].Visible = false; (gridContStokHareket.MainView as GridView).Columns["Birim"].Visible = false; (gridContStokHareket.MainView as GridView).Columns["IndirimOrani"].Visible = false; (gridContStokHareket.MainView as GridView).Columns["colIndirimTutar"].Visible = false; (gridContStokHareket.MainView as GridView).Columns["Aciklama"].Visible = false; //(gridContStokHareket.MainView as GridView).Columns["StokAdi"].Visible = false; link.Component = gridContStokHareket; link.Landscape = false; link.ShowPreview(); (gridContStokHareket.MainView as GridView).Columns["FisKodu"].Visible = true; (gridContStokHareket.MainView as GridView).Columns["Tarih"].Visible = true; (gridContStokHareket.MainView as GridView).Columns["Birim"].Visible = true; (gridContStokHareket.MainView as GridView).Columns["IndirimOrani"].Visible = true; (gridContStokHareket.MainView as GridView).Columns["colIndirimTutar"].Visible = true; (gridContStokHareket.MainView as GridView).Columns["Aciklama"].Visible = true; //(gridContStokHareket.MainView as GridView).Columns["StokAdi"].Visible = true; //(gridContStokHareket.MainView as GridView).Columns["StokAdi"].Visible = true; //(gridContStokHareket.MainView as GridView).Columns["StokAdi"].Visible = true; }
private void btnYazdir_Click(object sender, EventArgs e) { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = grid; link.Landscape = true; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.ShowPreview(); }
private void btnYazdir_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = gridControl1; link.Landscape = true; link.ShowPreview(); }
private void simpleButton2_Click(object sender, EventArgs e) { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = gridControl1; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.ShowPreview(); }
private void btnYazdir_Click(object sender, EventArgs e) { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = grid; link.Landscape = true; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.ShowPreview(); }
private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = gridContStokHareket; link.Landscape = true; link.ShowPreview(); }
private void yazdırToolStripMenuItem_Click(object sender, EventArgs e) { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = gridContStokHareket; link.ShowPreview(); }
public static void impirmir(PivotGridControl GrdGrilla, string MiTitulo) { Titulo = MiTitulo; PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = GrdGrilla; link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea); link.CreateDocument(); link.ShowPreview(); }
private void simpleButton3_Click(object sender, EventArgs e) { //gridControl1.ShowRibbonPrintPreview(); PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); // rapor önizleme sayfasında tarih aralığı yazdırmak için kullanılıyor link.Component = gridControl1; link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea); link.CreateDocument(); link.ShowPreview(); }
public void PrintPrev_Click(object sender, EventArgs e) { _ps = new PrintingSystem(); var pl = new PrintableComponentLink(); pl.CreateMarginalHeaderArea += this.Link1CreateMarginalHeaderArea; _ps.Links.AddRange(new object[] { pl }); pl.Component = this.GridControl; pl.ShowPreview(); }
private void sbtnYazdir_Click(object sender, EventArgs e) { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = gridControl1; link.PrintingSystem.Document.AutoFitToPagesWidth = 1; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.Landscape = true; link.ShowPreview(); }
public void PrintPivotToReport(PivotGridControl PGC, string HeaderMiddle) { PGC.OptionsPrint.PrintHeadersOnEveryPage = true; PGC.OptionsPrint.PrintDataHeaders = DevExpress.Utils.DefaultBoolean.False; PGC.OptionsPrint.PrintFilterHeaders = DevExpress.Utils.DefaultBoolean.False; PGC.OptionsPrint.PrintColumnHeaders = DevExpress.Utils.DefaultBoolean.False; PGC.OptionsPrint.UsePrintAppearance = true; PS.ClearContent(); PGC.RefreshData(); PCL.Component = PGC; PCL.PageHeaderFooter = new PageHeaderFooter(new PageHeaderArea(new string[] { "Printed At:-[Date Printed] [Time Printed]", string.Format("{0}\r\n{1}", GlobalVariables.CompanyName, HeaderMiddle), "[Page # of Pages #]" }, new Font("Arial Narrow", 10.25F, FontStyle.Bold, GraphicsUnit.Point, 0), BrickAlignment.Near), new PageFooterArea(new string[] { string.Empty, string.Empty, string.Empty }, new Font("Arial Narrow", 10.25F, FontStyle.Bold, GraphicsUnit.Point, 0), BrickAlignment.Near)); PCL.PaperKind = PaperKind.CSheet; PCL.PaperName = "Internal Report"; PCL.Landscape = true; PCL.Margins = new Margins(15, 15, 100, 100); PCL.MinMargins = new Margins(15, 15, 30, 30); ConfigurePrintingSystem(PS); PCL.PrintingSystemBase = PS; PCL.CreateDocument(); var autoFit = PCL.PrintingSystemBase.Document.AutoFitToPagesWidth; if (!IsMail) { if (PCL.PrintingSystemBase.Document.ScaleFactor > 1) { PCL.PrintingSystemBase.Document.AutoFitToPagesWidth = autoFit; } else { PCL.PrintingSystemBase.Document.AutoFitToPagesWidth = 1; } } PCL.ShowPreview(); }
private void btnPrint2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { PrintableComponentLink Link = new PrintableComponentLink(new PrintingSystem()); Link.Landscape = true; Link.Component = grdBlock; Link.CreateMarginalHeaderArea += Link2_CreateMarginalHeaderArea; Link.CreateMarginalFooterArea += Link_CreateMarginalFooterArea; Link.CreateDocument(); Link.ShowPreview(); }
private void btExport_Click(object sender, EventArgs e) { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = gridControl1; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.Margins = new System.Drawing.Printing.Margins(10, 10, 10, 10); link.Landscape = true; link.ShowPreview(); }
private void btnCetakRetur_Click(object sender, EventArgs e) { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = pivotGridOlapRetur; link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderAreaRetur); link.CreateMarginalFooterArea += new CreateAreaEventHandler(Link_CreateMarginalFooterAreaRetur); link.CreateReportHeaderArea += new CreateAreaEventHandler(Link_CreateReportHeaderAreaRetur); link.CreateDocument(); link.ShowPreview(); }
private void btnPrint_ItemClick(object sender, ItemClickEventArgs e) { PrintableComponentLink Link = new PrintableComponentLink(new PrintingSystem()); Link.Landscape = false; Link.Component = DGvTrans; Link.CreateMarginalHeaderArea += Link_CreateMarginalHeaderArea; Link.CreateMarginalFooterArea += Link_CreateMarginalFooterArea; Link.CreateDocument(); Link.ShowPreview(); }
private void simpleButton1_Click(object sender, EventArgs e) { PrintableComponentLink Link = new PrintableComponentLink(new PrintingSystem()); Link.Landscape = false; Link.Component = grdDemand; Link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea); Link.CreateMarginalFooterArea += new CreateAreaEventHandler(Link_CreateMarginalFooterArea); Link.CreateDocument(); Link.ShowPreview(); }
private void btnPrint_Click(object sender, EventArgs e) { gridViewPriceHistory.OptionsPrint.AutoWidth = true; var printableComponent = new PrintableComponentLink(new PrintingSystem()) { Component = gridPriceHistory, Landscape = true, PaperKind = PaperKind.A4, }; printableComponent.CreateReportHeaderArea += printableComponent_CreateReportHeaderArea; printableComponent.CreateDocument(); printableComponent.ShowPreview(); }
/// <summary> /// 数据表格打印预览 /// </summary> /// <param name="ListGrid">数据表格</param> /// <param name="strHead">表头显示信息</param> public static void PrintView(DevExpress.XtraGrid.GridControl ListGrid,DevExpress.XtraGrid.Views.Grid.GridView gridView, string strHead) { Cursor currentCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; //"Report file creating","Read Data, Please waiting..." DevExpress.Utils.WaitDialogForm frmWait = new DevExpress.Utils.WaitDialogForm("正在获取数据,请稍候...", "表格报表"); frmWait.Show(); //以下以前的一种用法,现在改为可加上表头信息的印方式 //if (DevExpress.XtraPrinting.PrintHelper.IsPrintingAvailable) // DevExpress.XtraPrinting.PrintHelper.ShowPreview(ListGrid); //else // //"XtraPrinting Library is not found..." // DevExpress.XtraEditors.XtraMessageBox.Show(common.GetLanguageWord("MESSAGE", "M0028"), "", MessageBoxButtons.OK, MessageBoxIcon.Information); //以下为采用新的打印方式 string middleColumn = strHead; string rightColumn = string.Format("打印时间:{0:g}", DateTime.Now); PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; phf.Header.Content.Clear(); phf.Header.Font = new Font("宋体", 12, FontStyle.Bold); phf.Header.Content.AddRange(new string[] { "打印用户:" + Common._personname, middleColumn, rightColumn }); phf.Footer.Content.AddRange(new string[] { "", "页次[页 #/#]", "" }); gridView.OptionsPrint.AutoWidth = false; //<- 2012-09-18 add link.Component = ListGrid; //link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea); DevExpress.LookAndFeel.UserLookAndFeel lookfeel = new DevExpress.LookAndFeel.UserLookAndFeel(ListGrid); lookfeel.ParentLookAndFeel = ListGrid.LookAndFeel; PrintingSystem printSystem = new PrintingSystem(); PrinterSettingsUsing pst = new PrinterSettingsUsing(); pst.UseMargins = true; pst.UsePaperKind = true; printSystem.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.A4; printSystem.PageSettings.PaperName = "A4"; printSystem.PageSettings.LeftMargin = 1; printSystem.PageSettings.RightMargin = 1; printSystem.PageSettings.Landscape = true; printSystem.PageSettings.AssignDefaultPrinterSettings(pst); link.PaperKind = printSystem.PageSettings.PaperKind; link.Margins = printSystem.PageSettings.Margins; link.Landscape = printSystem.PageSettings.Landscape; link.CreateDocument(); link.ShowPreview(lookfeel); Cursor.Current = currentCursor; frmWait.Dispose(); frmWait = null; }
protected virtual void OnPreview() { if (Printer == null) return; SplashScreenManager.ShowForm(typeof (EasyWaitForm)); var ps = new PrintingSystem(); var link = new PrintableComponentLink(ps); link.Component = Printer; link.PaperKind = PaperKind.A4; link.CreateReportHeaderArea += printableComponentLink_CreateReportHeaderArea; link.CreateReportFooterArea += printableComponentLink_CreateReportFooterArea; link.Margins.Bottom = link.Margins.Left = link.Margins.Right = link.Margins.Top = 50; link.CreateDocument(); link.ShowPreview(); SplashScreenManager.CloseForm(); }