private void galleryControlGallery1_ItemClick(object sender, DevExpress.XtraBars.Ribbon.GalleryItemClickEventArgs e) { string index = string.Format("{0}", e.Item.Tag); frmMain frm = BackstageView.Ribbon.FindForm() as frmMain; if(frm == null) return; if(index.Contains("PDF")) saveFileDialog1.Filter = Properties.Resources.PDFFilter; else if(index.Contains("HTML")) saveFileDialog1.Filter = Properties.Resources.HTMLFilter; else if(index.Contains("MHT")) saveFileDialog1.Filter = Properties.Resources.MHTFilter; else if(index.Contains("RTF")) saveFileDialog1.Filter = Properties.Resources.RTFFilter; else if(index.Contains("XLS")) saveFileDialog1.Filter = Properties.Resources.XLSFilter; else if(index.Contains("XLSX")) saveFileDialog1.Filter = Properties.Resources.XLSXFilter; else if(index.Contains("CSV")) saveFileDialog1.Filter = Properties.Resources.CSVFilter; else if(index.Contains("Text")) saveFileDialog1.Filter = Properties.Resources.TextFilter; else if(index.Contains("Image")) saveFileDialog1.Filter = Properties.Resources.ImageFilter; saveFileDialog1.Filter += "|" + Properties.Resources.AllFilesFilter; saveFileDialog1.FilterIndex = 0; saveFileDialog1.FileName = frm.CurrentModuleName; if(saveFileDialog1.ShowDialog() != DialogResult.OK) return; Cursor.Current = Cursors.WaitCursor; PrintingSystem ps = new PrintingSystem(); PrintableComponentLink link = new PrintableComponentLink(ps); link.Component = frm.CurrentExportComponent; link.CreateDocument(); ExportTo(index, saveFileDialog1.FileName, ps); }
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 btnPrint_Click(object sender, EventArgs e) { grdViewSTVForChecking.OptionsPrint.AutoWidth = true; var pcLink = new PrintableComponentLink(new PrintingSystem()) {Component = grdSTVs, Landscape = true}; pcLink.CreateDocument(); pcLink.ShowPreviewDialog(); }
public void ShowPrintPreview(string caption, IPrintable printableComponent) { var printingSystem = new PrintingSystem(); var link = new PrintableComponentLink(printingSystem); link.Component = printableComponent; link.CreateDocument(); ShowPrintPreview(caption, printingSystem); }
public void Print() { PrintableComponentLink printableLink = new PrintableComponentLink(new PrintingSystem()); printableLink.Component = gridControl2; printableLink.Landscape = true; printableLink.CreateDocument(Printing); ShowRibbonPreviewDialog(printableLink); }
private void button1_Click_1(object sender, EventArgs e) { PrintableComponentLink pcl = new PrintableComponentLink(new PrintingSystem()); pcl.Component = gridControl1; pcl.CreateReportHeaderArea += new CreateAreaEventHandler(pcl_CreateReportHeaderArea); pcl.CreateDocument(); pcl.ShowPreviewDialog(); }
void CreateDocumentThreadMethod() { try { Pcl.CreateDocument(); return; } catch (Exception ex) { ex = ex; } // cross thread exception caught here }
//YAZDIRMA private void btnYazdir_Click(object sender, EventArgs e) { PrintableComponentLink yazdir = new PrintableComponentLink(new PrintingSystem()); yazdir.Component = gridFaturaDetay; yazdir.CreateDocument(); PrintTool printTool = new PrintTool(yazdir.PrintingSystemBase); yazdir.ShowPreviewDialog(); }
void yazdir(GridControl gc) { PrintableComponentLink printableLink = new PrintableComponentLink(new PrintingSystem()); printableLink.Component = gc; printableLink.Landscape = true; printableLink.CreateDocument(Printing); ShowRibbonPreviewDialog(printableLink); printableLink.Dispose(); }
private PrintableComponentLink PrepareGridForPrint(GridView gridView) { gridView.OptionsPrint.AutoWidth = true; var printComp = new PrintableComponentLink(new PrintingSystem()); printComp.CreateReportHeaderArea += PrintCompOnCreateReportHeaderArea; printComp.Component = gridView.GridControl; printComp.CreateDocument(); return(printComp); }
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { PrintableComponentLink componentLink = new PrintableComponentLink(new PrintingSystem()); componentLink.Component = chartControl1; componentLink.CreateDocument(); PrintTool pt = new PrintTool(componentLink.PrintingSystemBase); pt.ShowPreviewDialog(); }
private void simpleButton1_Click(object sender, EventArgs e) { PrintableComponentLink componentLink = new PrintableComponentLink(new PrintingSystem()); componentLink.Component = gridControl1; componentLink.CreateDocument(); PrintTool pt = new PrintTool(componentLink.PrintingSystemBase); pt.ShowPreviewDialog(); }
public void Print() { PrintableComponentLink printableLink = new PrintableComponentLink(new PrintingSystem()); printableLink.Component = gCMusteriKarlikRaporu; printableLink.Landscape = true; printableLink.CreateDocument(Printing); ShowRibbonPreviewDialog(printableLink); }
void yazdir() { PrintableComponentLink printableLink = new PrintableComponentLink(new PrintingSystem()); //printableLink.Component = gcGunSonuOzet; printableLink.Landscape = true; printableLink.CreateDocument(Printing); ShowRibbonPreviewDialog(printableLink); printableLink.Dispose(); }
private void btnGiderlerYazdir_Click(object sender, EventArgs e) { PrintableComponentLink printableLink = new PrintableComponentLink(new PrintingSystem()); printableLink.Component = gcGiderler; printableLink.Landscape = true; printableLink.CreateDocument(Printing); ShowRibbonPreviewDialog(printableLink); printableLink.Dispose(); }
private void simpleButton3_Click(object sender, EventArgs e) { PrintableComponentLink printableLink = new PrintableComponentLink(new PrintingSystem()); printableLink.Component = gridControl2; printableLink.Landscape = true; printableLink.CreateDocument(Printing); ShowRibbonPreviewDialog(printableLink); printableLink.Dispose(); }
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 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(); }
public void Imprimir() { PrintableComponentLink componentLink = new PrintableComponentLink(new PrintingSystem()); componentLink.Component = gridControl1; componentLink.CreateDocument(); PrintTool pt = new PrintTool(componentLink.PrintingSystemBase); pt.ShowPreviewDialog(); }
public void Print() { PrintableComponentLink printableLink = new PrintableComponentLink(new PrintingSystem()); //printableLink.Component = gCPerHareketleri; printableLink.Landscape = true; printableLink.CreateDocument(Printing); ShowRibbonPreviewDialog(printableLink); }
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 barButtonItem2_ItemClick_1(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { PrintableComponentLink Link = new PrintableComponentLink(new PrintingSystem()); Link.Landscape = false; Link.Component = grdReceipt; Link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea); Link.CreateMarginalFooterArea += new CreateAreaEventHandler(Link_CreateMarginalFooterArea); Link.CreateDocument(); Link.ShowPreview(); }
public void CreatePdf() { PrintingSystem ps = new PrintingSystem(); PrintableComponentLink pc = new PrintableComponentLink(ps); pc.Component = gridControl; pc.PaperKind = System.Drawing.Printing.PaperKind.A4Extra; pc.Landscape = true; pc.CreateDocument(); pc.PrintingSystemBase.ExportToPdf(Application.StartupPath + "\\Temp\\tmp.pdf"); }
private void simpleButton2_Click(object sender, EventArgs e) { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = this.mainGrid; link.Landscape = true; link.PaperKind = System.Drawing.Printing.PaperKind.A3; link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea); 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 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_Click(object sender, EventArgs e) { grdViewSTVForChecking.OptionsPrint.AutoWidth = true; var pcLink = new PrintableComponentLink(new PrintingSystem()) { Component = grdSTVs, Landscape = true }; pcLink.CreateDocument(); pcLink.ShowPreviewDialog(); }
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 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 barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { PrintableComponentLink Link = new PrintableComponentLink(new PrintingSystem()); Link.Landscape = false; Link.Component = chartControl1; Link.CreateMarginalHeaderArea += Link_CreateMarginalHeaderArea; Link.CreateMarginalFooterArea += Link_CreateMarginalFooterArea; Link.CreateDocument(); Link.ShowPreview(); }
private void btnPrint3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { PrintableComponentLink Link = new PrintableComponentLink(new PrintingSystem()); Link.PaperKind = System.Drawing.Printing.PaperKind.A2; Link.Landscape = true; Link.Component = grdFlat; Link.CreateMarginalHeaderArea += Link3_CreateMarginalHeaderArea; Link.CreateMarginalFooterArea += Link_CreateMarginalFooterArea; Link.CreateDocument(); Link.ShowPreview(); }
/// <summary> /// Custom export to excel /// </summary> /// <param name="grid"></param> /// <param name="fileName"></param> public void ExportDataToExcel(GridControl grid, string fileName) { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); link.Component = grid; link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeeaderArea); link.CreateDocument(); link.ExportToXlsx(fileName); }
private void btnPrint_ItemClick(object sender, ItemClickEventArgs e) { //DGvTransView.ShowPrintPreview(); PrintableComponentLink Link = new PrintableComponentLink(new PrintingSystem()); Link.Landscape = false; Link.Component = grdBroker; Link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea); Link.CreateMarginalFooterArea += new CreateAreaEventHandler(Link_CreateMarginalFooterArea); Link.CreateDocument(); Link.ShowPreview(); }
protected void ASPxButton2_Click(object sender, EventArgs e) { using (MemoryStream ms = new MemoryStream()) { PrintableComponentLink pcl = new PrintableComponentLink(new PrintingSystem()); pcl.Component = ASPxGridViewExporter3; pcl.Margins.Left = pcl.Margins.Right = 0; pcl.Margins.Top = 50; pcl.Landscape = true; pcl.CreateDocument(true); pcl.PrintingSystem.Document.AutoFitToPagesWidth = 1; PageHeaderFooter phf = pcl.PageHeaderFooter as PageHeaderFooter; phf.Header.Content.Clear(); //phf.Header.Content.AddRange(new string[] { leftColumn, middleColumn, rightColumn }); phf.Header.LineAlignment = BrickAlignment.Far; pcl.ExportToPdf(ms); WriteResponse(this.Response, ms.ToArray(), System.Net.Mime.DispositionTypeNames.Attachment.ToString()); } }
public static void DevPrint(GridControl gc,String printHeader) { var ps = new PrintingSystem(); var link = new PrintableComponentLink(ps); ps.Links.Add(link); link.Component = gc;//这里可以是可打印的部件 var phf = link.PageHeaderFooter as PageHeaderFooter; if (phf != null) { phf.Header.Content.Clear(); phf.Header.Content.AddRange(new[] { "", printHeader, "" }); phf.Header.Font = new System.Drawing.Font("宋体", 14, System.Drawing.FontStyle.Bold); phf.Header.LineAlignment = BrickAlignment.Center; } link.CreateDocument(); //建立文档 ps.PreviewFormEx.Show(); }
public ReportCenter(IPrintable Printable, string ReportName, string Condition) { printSystem = new PrintingSystem(); mReportName = ReportName; mCondition = Condition; PrintableComponentLink pcl = new PrintableComponentLink(); pcl.CreateMarginalHeaderArea += new DevExpress.XtraPrinting.CreateAreaEventHandler(link_CreateMarginalHeaderArea); pcl.CreateMarginalFooterArea += new DevExpress.XtraPrinting.CreateAreaEventHandler(link_CreateMarginalFooterArea); pcl.Component = Printable; printSystem.Links.Add(pcl); pcl.CreateDocument(); PrinterSettingsUsing pst = new PrinterSettingsUsing(); pst.UseMargins = true; //pst.UsePaperKind = false; printSystem.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.A4; printSystem.PageSettings.PaperName = "A4"; printSystem.PageSettings.LeftMargin = 30; printSystem.PageSettings.RightMargin = 30; printSystem.PageSettings.AssignDefaultPrinterSettings(pst); }
protected virtual void OnExportXls() { if (Printer == null) return; var ps = new PrintingSystem(); var link = new PrintableComponentLink(ps); link.Component = Printer; link.CreateReportHeaderArea += printableComponentLink_CreateReportHeaderArea; link.PaperKind = PaperKind.A4; link.Margins.Bottom = link.Margins.Left = link.Margins.Right = link.Margins.Top = 50; link.CreateDocument(); var fileName = string.Empty; var save = new SaveFileDialog(); save.Filter = "Exel 2003 (*.xls)|*.xls"; if (save.ShowDialog() == DialogResult.OK) fileName = save.FileName; if (string.IsNullOrEmpty(fileName)) return; link.ExportToXls(fileName); }
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(); }
private void nbiPrintPreviewRibbon_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { using(DevExpress.XtraPrinting.Preview.PrintPreviewRibbonFormEx form = new DevExpress.XtraPrinting.Preview.PrintPreviewRibbonFormEx()) { PrintingSystem ps = new PrintingSystem(); form.PrintControl.PrintingSystem = ps; PrintableComponentLink link = new PrintableComponentLink(ps); link.Component = gridControl1; link.CreateDocument(); form.ShowDialog(); } }
protected void ShowPrintPreview() { if(CurrentPrintableComponent == null) return; PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); if(modulesNavigator.CurrentModule.AllowRtfTitle) { link.RtfReportHeader = @"{\rtf1\ansi\ansicpg1251\deff0\deflang1049{\fonttbl{\f0\fnil\fcharset0 Segoe UI;}} {\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\sa200\sl276\slmult1\qc\lang9\f0\fs32 " + CurrentModuleName + @"\par }"; } link.Component = CurrentPrintableComponent; link.CreateDocument(); link.ShowRibbonPreviewDialog(this.LookAndFeel); }
public PrintableComponentLink Draw(IPrintable gridControl, String mainTitle, String subTitle) { float height = 0; DevExpress.XtraPrinting.PrintingSystem printingSystem1; printingSystem1 = new DevExpress.XtraPrinting.PrintingSystem(); ((System.ComponentModel.ISupportInitialize)(printingSystem1)).BeginInit(); DevExpress.XtraPrinting.PrintableComponentLink printableComponentLink1; printableComponentLink1 = new DevExpress.XtraPrinting.PrintableComponentLink(); printableComponentLink1.PaperKind = System.Drawing.Printing.PaperKind.A4; printableComponentLink1.Margins.Left = 50; printableComponentLink1.Margins.Right = 50; printableComponentLink1.Margins.Top = 50; printableComponentLink1.Margins.Bottom = 50; printingSystem1.Links.AddRange(new object[] { printableComponentLink1 }); printableComponentLink1.Component = gridControl; printableComponentLink1.PrintingSystem = printingSystem1; DevExpress.XtraPrinting.PageHeaderArea headerArea; headerArea = new DevExpress.XtraPrinting.PageHeaderArea(); headerArea.Content.Add(reportHeader); headerArea.LineAlignment = DevExpress.XtraPrinting.BrickAlignment.Near; #region Đầu trang if (rtfGridHeader != null) { printableComponentLink1.RtfReportHeader = rtfGridHeader; height = rtfGridHeaderHeight; } printableComponentLink1.CreateReportHeaderArea += delegate(object sender, DevExpress.XtraPrinting.CreateAreaEventArgs e) { float currentHeight = height; #region Giải pháp 1 Image headerImage = (this.ReportHeaderImage == null ? FWImageDic.LOGO_IMAGE48 : this.ReportHeaderImage); DevExpress.XtraPrinting.ImageBrick logo; logo = e.Graph.DrawImage(headerImage, new RectangleF(10, 5, headerImage.Width, headerImage.Height), DevExpress.XtraPrinting.BorderSide.None, Color.Transparent); //currentHeight += headerImage.Height; #endregion if (mainTitle != null) { DevExpress.XtraPrinting.TextBrick brick; brick = e.Graph.DrawString(mainTitle, Color.Navy, new RectangleF(0, currentHeight, 620, 40), DevExpress.XtraPrinting.BorderSide.None); currentHeight += 40; brick.Font = new Font("Tahoma", 20); brick.StringFormat = new DevExpress.XtraPrinting.BrickStringFormat(StringAlignment.Center); brick.BackColor = Color.White; brick.ForeColor = Color.Black; } if (subTitle != null) { DevExpress.XtraPrinting.TextBrick brickDate; brickDate = e.Graph.DrawString(subTitle, Color.Navy, new RectangleF(0, currentHeight, 620, 40), DevExpress.XtraPrinting.BorderSide.None); currentHeight += 40; brickDate.Font = new Font("Tahoma", 10); brickDate.StringFormat = new DevExpress.XtraPrinting.BrickStringFormat(StringAlignment.Center); brickDate.BackColor = Color.White; brickDate.ForeColor = Color.Black; } }; #endregion if (rtfGridFooter != null) printableComponentLink1.RtfReportFooter = rtfGridFooter; #region Header Footer DevExpress.XtraPrinting.PageFooterArea footerArea; footerArea = new DevExpress.XtraPrinting.PageFooterArea(); footerArea.Content.Add(reportFooter); footerArea.LineAlignment = DevExpress.XtraPrinting.BrickAlignment.Near; DevExpress.XtraPrinting.PageHeaderFooter pageHeaderFooter; pageHeaderFooter = new DevExpress.XtraPrinting.PageHeaderFooter(headerArea, footerArea); printableComponentLink1.PageHeaderFooter = pageHeaderFooter; #endregion ((System.ComponentModel.ISupportInitialize)(printingSystem1)).EndInit(); printableComponentLink1.CreateDocument(); return printableComponentLink1; }
void CreateLink(PrintingSystem ps) { frmMain frm = FindForm() as frmMain; bool showMemo = memoStyle.Checked && frm.CurrentRichEdit != null; if(showMemo) { Link link = new Link(ps); link.RtfReportHeader = frm.CurrentRichEdit.RtfText; link.PaperKind = GetPaperKind(); link.Landscape = GetLandscape(); link.Margins = GetMargins(); link.CreateDocument(); } else { PrintableComponentLink link = new PrintableComponentLink(ps); link.Component = frm.CurrentPrintableComponent; link.PaperKind = GetPaperKind(); link.Landscape = GetLandscape(); link.Margins = GetMargins(); link.CreateDocument(); } }
private void btnPrint_Click(object sender, EventArgs e) { var ps = new PrintingSystem(); var pcl = new PrintableComponentLink(ps); pcl.CreateReportHeaderArea += PclCreateReportHeaderArea; pcl.Component = gridAdjustments; pcl.Landscape = true; pcl.CreateDocument(); ps.PreviewFormEx.ShowDialog(); }
public void CreateReport() { var link = new PrintableComponentLink(new PrintingSystem()); link.Margins.Left = 100; link.Margins.Right = 100; link.Margins.Top = 100; link.Margins.Bottom = 90; link.PaperKind = PaperKind.A4; if (LoadReport == 0) link.Component = gridControl1; if (LoadReport == 1) { link.Component = gridControl2; link.Landscape = true; } PageFooterArea footer = new PageFooterArea(); footer.Content.Add("Printed on " + "[Date Printed]" + " by " + Utils.Username); footer.LineAlignment = BrickAlignment.Near; PageHeaderArea header = new PageHeaderArea(); link.CreateMarginalHeaderArea += CreateMarginalHeaderArea; link.PageHeaderFooter = new PageHeaderFooter(header, footer); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Save, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Watermark, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.FillBackground, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.HandTool, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Open, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Customize, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Scale, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Parameters, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.SubmitParameters, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Background, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.None, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.DocumentMap, CommandVisibility.None); link.PrintingSystem.PreviewRibbonFormEx.RibbonControl.Pages["Print Preview"].Groups["Document"].Visible = false; link.PrintingSystem.PreviewRibbonFormEx.RibbonControl.Pages["Print Preview"].Groups["Background"].Visible = false; link.PrintingSystem.PreviewRibbonFormEx.RibbonControl.Pages["Print Preview"].Groups["Zoom"].Visible = false; link.CreateDocument(); link.PrintingSystem.Document.AutoFitToPagesWidth = 1; link.ShowRibbonPreview(UserLookAndFeel.Default); }
/// <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; }
public void ExportData() { using (var dialog = new SaveFileDialog()) { dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); dialog.FileName = string.Format("quickSITES & Emails({0}).xlsx", DateTime.Now.ToString("MMddyy-hmmtt")); dialog.Filter = "Excel files|*.xlsx"; dialog.Title = "Export quickSites & Emails"; if (dialog.ShowDialog() != DialogResult.OK) return; var options = new XlsxExportOptions(); options.SheetName = Path.GetFileNameWithoutExtension(dialog.FileName); options.TextExportMode = TextExportMode.Text; options.ExportHyperlinks = true; options.ShowGridLines = true; options.ExportMode = XlsxExportMode.SingleFile; var parts = new Dictionary<string, string>(); using (var form = new FormProgress()) { FormMain.Instance.ribbonControl.Enabled = false; Enabled = false; form.laProgress.Text = "Exporting data..."; form.TopMost = true; form.Show(); Application.DoEvents(); var thread = new Thread(() => { var tempFile = Path.Combine(Path.GetTempPath(), String.Format("{0}.xlsx", Guid.NewGuid())); BeginInvoke(new Action(() => { using (var printingSystem = new PrintingSystem()) { var printLink = new PrintableComponentLink { Landscape = true, PaperKind = PaperKind.A4, Component = gridControlRecords }; printLink.CreateReportHeaderArea += OnCreateReportHeaderArea; printLink.CreateDocument(printingSystem); printingSystem.ExportToXlsx(tempFile, options); } })); parts.Add("quickSITES & Emails", tempFile); ActivityExportHelper.ExportCommonData(dialog.FileName, parts); }); thread.Start(); while (thread.IsAlive) { Thread.Sleep(100); Application.DoEvents(); } form.Close(); Enabled = true; FormMain.Instance.ribbonControl.Enabled = true; } if (File.Exists(dialog.FileName)) Process.Start(dialog.FileName); } }
private PrintableComponentLink PrepareGridForPrint(GridView gridView) { gridView.OptionsPrint.AutoWidth = true; var printComp = new PrintableComponentLink(new PrintingSystem()); printComp.CreateReportHeaderArea += PrintCompOnCreateReportHeaderArea; printComp.Component = gridView.GridControl; printComp.CreateDocument(); return printComp; }
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(); }
public void DoPivoitPrint(PivotGridControl pivotGridControl, bool landscape = true) { var link = new PrintableComponentLink(new PrintingSystem()) { Margins = { Left = 10, Right = 10, Top = 110, Bottom = 90 }, Landscape = landscape, PaperKind = PaperKind.A4, Component = pivotGridControl }; var footer = new PageFooterArea(); footer.Content.Add("Printed on " + "[Date Printed]" + " by " + Utils.Username); footer.Content.Add("Page " + "[Page #]"); footer.LineAlignment = BrickAlignment.Near; var header = new PageHeaderArea(); link.CreateMarginalHeaderArea += CreateMarginalDetailHeaderArea; link.CreateMarginalFooterArea += CreateMarginalFooterArea; link.PageHeaderFooter = new PageHeaderFooter(header, footer); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Save, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Watermark, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.FillBackground, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.HandTool, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Open, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Customize, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Scale, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Parameters, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.SubmitParameters, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.Background, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.None, CommandVisibility.None); link.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.DocumentMap, CommandVisibility.None); link.PrintingSystem.PreviewRibbonFormEx.RibbonControl.Pages["Print Preview"].Groups["Document"].Visible = false; link.PrintingSystem.PreviewRibbonFormEx.RibbonControl.Pages["Print Preview"].Groups["Background"].Visible = false; link.PrintingSystem.PreviewRibbonFormEx.RibbonControl.Pages["Print Preview"].Groups["Zoom"].Visible = false; link.CreateDocument(); link.PrintingSystem.Document.AutoFitToPagesWidth = 1; link.ShowRibbonPreview(UserLookAndFeel.Default); }