zoukankan      html  css  js  c++  java
  • DEV GridControl打印 导出

     /// <summary>
            /// 打印
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void barbtnPrint_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
            {
                PrintingSystem print = new DevExpress.XtraPrinting.PrintingSystem();
                PrintableComponentLink link = new PrintableComponentLink(print);
                print.Links.Add(link);
                link.Component = grd_newmembersummary;//这里可以是可打印的部件
                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(); //建立文档
                print.PreviewFormEx.Show();//进行预览
            }
            /// <summary>
            /// 导出
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void barbtnExport_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
            {
                SaveFileDialog fileDialog = new SaveFileDialog();
                fileDialog.Title = "导出Excel";
                fileDialog.Filter = "Excel文件(*.xls)|*.xls";
                DialogResult dialogResult = fileDialog.ShowDialog(this);
                if (dialogResult == DialogResult.OK)
                {
                    DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions();
                    grd_newmembersummary.ExportToXls(fileDialog.FileName);
                    DevExpress.XtraEditors.XtraMessageBox.Show("导出成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
    
  • 相关阅读:
    Linux eclipse 编译C++
    poj2774 Long Long Message(后缀数组or后缀自动机)
    ural 1297 Palindrome(Manacher模板题)
    bzoj 2049 Cave 洞穴勘测(LCT)
    codeforces 519E A and B and Lecture Rooms(LCA,倍增)
    hdu3830 (二分+LCA)
    codeforces 337D Book of Evil(dp)
    codeforces 22C System Administrator(构造水题)
    codeforces 144D Missile Silos(最短路)
    codeforces 505B Mr. Kitayuta's Colorful Graph(水题)
  • 原文地址:https://www.cnblogs.com/goto/p/3445238.html
Copyright © 2011-2022 走看看