当前位置: 首页>>代码示例>>C#>>正文


C# GridView.ExportToRtf方法代码示例

本文整理汇总了C#中GridView.ExportToRtf方法的典型用法代码示例。如果您正苦于以下问题:C# GridView.ExportToRtf方法的具体用法?C# GridView.ExportToRtf怎么用?C# GridView.ExportToRtf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GridView的用法示例。


在下文中一共展示了GridView.ExportToRtf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: exportFile

        /// <summary>
        /// Xuất ra file dữ liệu trên gridView và định dạng dựa vào ext
        /// </summary>
        public static bool exportFile(GridView gridView, String ext, bool openFile, ref string outFileName, bool useHeader)
        {
            bool flag = false;
            bool succ = false;
            string filePath = null;
            bool flagShowView = gridView.OptionsView.ShowViewCaption;
            try
            {
                SaveFileDialog f = new SaveFileDialog();
                f.Title = "Chọn tên tập tin muốn lưu";
                if (ext.Equals("xls"))
                    f.Filter = "Excel 97 - 2003 files (*.xls)|*.xls";
                else if (ext.Equals("xlsx"))
                    f.Filter = "Excel 2007 files (*.xlsx)|*.xlsx";
                else if (ext.Equals("pdf"))
                    f.Filter = "PDF (*.pdf)|*.pdf";
                else if (ext.Equals("htm"))
                    f.Filter = "Web Pages (*.htm)|*.htm";
                else if (ext.Equals("rtf"))
                    f.Filter = "Rich Text files (*.rtf)|*.rtf";

                f.ShowDialog();

                PrintableComponentLink link = null;

                if (useHeader && gridView.GridControl != null)
                {
                    if (FrameworkParams.headerLetter != null)
                    {
                        gridView.OptionsView.ShowViewCaption = false;
                        link = FrameworkParams.headerLetter.Draw(gridView.GridControl, gridView.ViewCaption,
                            "Ngày xuất báo cáo: " + DateTime.Today.ToString(FrameworkParams.option.dateFormat));
                    }
                }

                if (f.FileName != "")
                {
                    filePath = f.FileName;

                    if (FrameworkParams.wait == null)
                    {
                        FrameworkParams.wait = new WaitingMsg();
                        flag = true;
                    }

                    if (ext.Equals("xls"))
                    {
                        if (gridView is PLGridView)
                        {
                            if (link != null)
                                link.PrintingSystem.ExportToXls(f.FileName, new XlsExportOptions(((PLGridView)gridView)._TextExportMode));
                            else
                                gridView.ExportToXls(f.FileName, new XlsExportOptions(((PLGridView)gridView)._TextExportMode));
                        }
                        else
                        {
                            if (link != null)
                                link.PrintingSystem.ExportToXls(f.FileName, new XlsExportOptions(TextExportMode.Text));
                            else
                                gridView.ExportToXls(f.FileName, new XlsExportOptions(TextExportMode.Text));
                        }
                        succ = true;
                    }
                    else if (ext.Equals("xlsx"))
                    {
                        if (gridView is PLGridView)
                        {

                            if (link != null)
                                link.PrintingSystem.ExportToXlsx(f.FileName, new XlsxExportOptions(((PLGridView)gridView)._TextExportMode));
                            else
                                gridView.ExportToXlsx(f.FileName, new XlsxExportOptions(((PLGridView)gridView)._TextExportMode));
                        }
                        else
                        {
                            if (link != null)
                                link.PrintingSystem.ExportToXlsx(f.FileName, new XlsxExportOptions(TextExportMode.Text));
                            else
                                gridView.ExportToXlsx(f.FileName, new XlsxExportOptions(TextExportMode.Text));
                        }
                        succ = true;
                    }
                    else if (ext.Equals("pdf"))
                    {
                        if (link != null)
                            link.PrintingSystem.ExportToPdf(f.FileName);
                        else
                            gridView.ExportToPdf(f.FileName);
                        succ = true;
                    }
                    else if (ext.Equals("rtf"))
                    {
                        if (link != null)
                            link.PrintingSystem.ExportToRtf(f.FileName);
                        else
                            gridView.ExportToRtf(f.FileName);
                        succ = true;
//.........这里部分代码省略.........
开发者ID:khanhdtn,项目名称:my-fw-win,代码行数:101,代码来源:HelpGrid.cs

示例2: ExportData

 public static void ExportData(DataTable _dt, GridView _grid)
 {
     if (_dt != null && _dt.Rows.Count > 0)
     {
         SaveFileDialog sDialog = new SaveFileDialog();
         sDialog.Filter = "Microsoft Excel (*.xls)|*.xls|Microsoft Excel 2007 (*.xlsx)|*.xlsx|PDF (*.pdf)|*.pdf|Rich Text Format (*.rtf)|*.rtf|Webpage (*.html)|*.html|Rich Text File (*.rtf)|*.rtf|Text File (*.txt)|*.txt";
         sDialog.Title = Lang.GetMessageByLanguage("000007", Culture, ResourceMessage);
         if (sDialog.ShowDialog() == DialogResult.OK)
         {
             switch (sDialog.FilterIndex)
             {
                 case 1:
                     _grid.ExportToXls(sDialog.FileName);
                     break;
                 case 2:
                     _grid.ExportToXlsx(sDialog.FileName);
                     break;
                 case 3:
                     _grid.ExportToPdf(sDialog.FileName);
                     break;
                 case 4:
                     _grid.ExportToText(sDialog.FileName);
                     break;
                 case 5:
                     _grid.ExportToHtml(sDialog.FileName);
                     break;
                 case 6:
                     _grid.ExportToRtf(sDialog.FileName);
                     break;
                 case 7:
                     _grid.ExportToText(sDialog.FileName);
                     break;
             }
             if (XtraMessageBox.Show(Lang.GetMessageByLanguage("000006", Culture, ResourceMessage).Replace("$FileName$", sDialog.FileName), (User.UserInfo.LanguageID.Equals("VN")) ? "Thông Báo" : "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
             {
                 Process.Start(sDialog.FileName);
             }
         }
     }
     else
     {
         return;
     }
 }
开发者ID:penguinsoftware,项目名称:iPOS,代码行数:44,代码来源:Common.cs


注:本文中的GridView.ExportToRtf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。