dev GridControl直接打印 纵向合并单元格
GridControl纵向合并单元格
只需设置 gridView->OptionView->AllowCellMerge=true;
效果
提示:
精确到列 前提是gridview1已经允许合并单元格(内容相同的才合并)
this.gridView1.Columns["班组"].OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.True;
gridControl直接打印:
public static void reportPrint(GridControl gridControl1,string title) { //PrintingSystem printingSystem1 = new PrintingSystem(); //PrintableComponentLink printableComponentLink1 = new PrintableComponentLink(); //// Add the link to the printing system's collection of links. //printingSystem1.Links.AddRange(new object[] { printableComponentLink1 }); //// Assign a control to be printed by this link. //printableComponentLink1.Component = gridControl1; //// Set the paper orientation to Landscape. //printableComponentLink1.Landscape = false; ////show预览 // printableComponentLink1.ShowPreview(); //直接打印 // printableComponentLink1.PrintDlg(); PrintingSystem print = new DevExpress.XtraPrinting.PrintingSystem(); PrintableComponentLink link = new PrintableComponentLink(print); print.Links.Add(link); link.Component = gridControl1;//这里可以是可打印的部件 string _PrintHeader = title; PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; //link.RtfReportHeader = "我是报表头"; //link.RtfReportFooter = "我是报表尾部"; link.PaperKind = System.Drawing.Printing.PaperKind.A4Plus; //设置纸张 link.Landscape = false; //mh phf.Header.Content.Clear(); phf.Header.Content.AddRange(new string[] { "", _PrintHeader, "" }); phf.Header.Font = new System.Drawing.Font("宋体", 16, System.Drawing.FontStyle.Bold); phf.Header.LineAlignment = BrickAlignment.Center; link.CreateDocument(); //建立文档 link.ShowPreviewDialog(); // print.PreviewFormEx.Show();//进行预览 非模式窗体 //直接打印 // print.PrintDlg(); }
以上代码自己找的 可行