Esempio n. 1
0
        private void ExportToEx(String filename, string ext, BaseView exportView)
        {
            Cursor currentCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;
            if (ext == "rtf")
            {
                exportView.ExportToRtf(filename);
            }
            if (ext == "pdf")
            {
                exportView.ExportToPdf(filename);
            }
            if (ext == "mht")
            {
                exportView.ExportToMht(filename);
            }
            if (ext == "htm")
            {
                exportView.ExportToHtml(filename);
            }
            if (ext == "txt")
            {
                exportView.ExportToText(filename);
            }
            if (ext == "xls")
            {
                exportView.ExportToXls(filename);
            }
            if (ext == "xlsx")
            {
                exportView.ExportToXlsx(filename);
            }
            Cursor.Current = currentCursor;
        }
Esempio n. 2
0
        private static void ExportGridAsPdf(this BaseView gridView, string fileType)
        {
            var exportFileName = GetFileNameViaSavePrompt(fileType, GlobalStrings.FileFilters.PDFFilter);

            if (!string.IsNullOrEmpty(exportFileName))
            {
                gridView.ExportToPdf(exportFileName);
            }
        }
Esempio n. 3
0
        public static bool Export(BaseView _view)
        {
            SaveFileDialog _sf = new SaveFileDialog();

            _sf.Filter      = "Excle文件|*.xls|HTML文件|*.mht|文本文件|*.TXT";
            _sf.FilterIndex = 1;
            string _fname = "";

            while (_fname == "")
            {
                if (_sf.ShowDialog() == DialogResult.OK)
                {
                    _fname = _sf.FileName;
                    if (_fname != "")
                    {
                        switch (_sf.FilterIndex)
                        {
                        case 1:
                            _view.ExportToXls(_fname, true);
                            break;

                        case 2:
                            _view.ExportToMht(_fname, "UTF-8", "", true);
                            break;

                        case 3:
                            _view.ExportToText(_fname, "\t");
                            break;

                        case 4:
                            _view.ExportToPdf(_fname);
                            break;
                        }
                        using (CommonService.CommonServiceClient _csc = new CommonService.CommonServiceClient())
                        {
                            int _exportRowCount = _view.RowCount;
                            _csc.WriteExportLog(_exportRowCount, (_view.Tag != null) ? _view.Tag.ToString() : "");
                            //if (XtraMessageBox.Show("导出文件已成功,是否立即打开?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            //{
                            //    System.Diagnostics.Process.Start(_fname);
                            //}
                            return(true);
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show("请输入导出文件名!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
Esempio n. 4
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (this.buttonEdit1.EditValue == null || this.buttonEdit1.EditValue.ToString() == "")
            {
                XtraMessageBox.Show("请输入导出文件名!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (this.comboBoxEdit1.EditValue == null)
            {
                XtraMessageBox.Show("请选择导出类型!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (CurrentView != null)
            {
                string _fname = this.buttonEdit1.EditValue.ToString();
                string _type  = this.comboBoxEdit1.EditValue.ToString();
                switch (_type)
                {
                case "Excle":
                    CurrentView.ExportToXls(_fname, true);
                    break;

                case "Pdf":
                    CurrentView.ExportToPdf(_fname);
                    break;

                case "Mht":
                    CurrentView.ExportToMht(_fname);
                    break;

                case "Text":
                    CurrentView.ExportToText(_fname);
                    break;
                }
            }
            int _exportRowCount = CurrentView.RowCount;

            using (CommonService.CommonServiceClient _csc = new CommonService.CommonServiceClient())
            {
                _csc.WriteExportLog(_exportRowCount, (CurrentView.Tag != null) ? CurrentView.Tag.ToString() : "");
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Esempio n. 5
0
        private void ExportToEx(String filename, string ext, BaseView exportView)
        {
            Cursor currentCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;
            DevExpress.XtraPrinting.IPrintingSystem ps = DevExpress.XtraPrinting.PrintHelper.GetCurrentPS();
            if (ext == "rtf")
            {
                exportView.ExportToRtf(filename);
            }
            if (ext == "pdf")
            {
                exportView.ExportToPdf(filename);
            }
            if (ext == "mht")
            {
                exportView.ExportToMht(filename);
            }
            if (ext == "htm")
            {
                exportView.ExportToHtml(filename);
            }
            if (ext == "txt")
            {
                exportView.ExportToText(filename);
            }
            if (ext == "xls")
            {
                exportView.ExportToXls(filename);
            }
            if (ext == "xlsx")
            {
                exportView.ExportToXlsx(filename);
            }
            Cursor.Current = currentCursor;
        }