DevExpress 常用命令包括导出-打印-打印预览等

3、表格打印也是最常见的,打印代码如下:

PrintingSystem ps = null;

DevExpress.XtraPrinting.PrintableComponentLink link = null;

ps = new DevExpress.XtraPrinting.PrintingSystem();

link = new DevExpress.XtraPrinting.PrintableComponentLink(ps);

ps.Links.Add(link);

link.Component = gridControl1;//这里可以是可打印的部件

string _PrintHeader = "打印示例";//标题

PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter; phf.Header.Content.Clear();

phf.Header.Content.AddRange(new string[] { "", _PrintHeader, "" });

phf.Header.Font = new System.Drawing.Font("宋体", 14, System.Drawing.FontStyle.Bold); phf.Header.LineAlignment = BrickAlignment.Center;

link.CreateDocument(); //建立文档 

ps.PreviewFormEx.Show();//预览

 

4、gridcontrol也可简单的导出excel,代码如下:

gridControl1.ExportToXls(Application.StartupPath + "\\导出示例.xls");

 

你可能感兴趣的:(DevExpress)