Exemplo n.º 1
0
        private void bt_export_Click(object sender, RoutedEventArgs e)
        {
            if (GetSelectItemsCount() <= 0)
            {
                return;
            }
            string filepath = "";

            SaveFile(ref filepath);
            if (string.IsNullOrEmpty(filepath))
            {
                return;
            }
            ExcelOper excel = new ExcelOper(filepath);

            foreach (QueryDataViewModel qvm in obc_qvm)
            {
                if (qvm.IsSelected)
                {
                    this.report = new ReportModelBlock(qvm.SampleComment);
                    excel.PrintOneReportBlcok(report);
                }
            }
            excel.Save();
            excel.Quit();
            MessageBox.Show("Done!", "Information");
        }
Exemplo n.º 2
0
        private void button_export_Click(object sender, RoutedEventArgs e)
        {
            if (obc_project.Count == 0)
            {
                return;
            }
            string filepath = "";

            SaveFile(ref filepath);
            if (string.IsNullOrEmpty(filepath))
            {
                return;
            }
            ExcelOper excel = new ExcelOper(filepath);

            try
            {
                foreach (ProjectEstimateViewModel project in obc_project)
                {
                    excel.PrintOneProjectEstimateBlcok(project);
                }
                MessageBox.Show("成功导出", "Information");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            finally
            {
                excel.Save();
                excel.Quit();
            }
        }
Exemplo n.º 3
0
        private void button_export_Click(object sender, RoutedEventArgs e)
        {
            if (obc_budgetary.Count == 0)
            {
                return;
            }
            string filepath = "";

            SaveFile(ref filepath);
            if (string.IsNullOrEmpty(filepath))
            {
                return;
            }
            ExcelOper excel = new ExcelOper(filepath);

            try
            {
                foreach (BudgetaryUpperLimit limit in obc_budgetary)
                {
                    excel.PrintOneBudgetaryUpperLimitBlock(limit);
                }
                MessageBox.Show("成功导出", "Information");
            }
            catch (Exception ex)
            {
                MessageBox.Show("过程出现错误", "Error");
            }
            finally
            {
                excel.Save();
                excel.Quit();
            }
        }
Exemplo n.º 4
0
        private bool ExportToExcel(string path)
        {
            if (this._dt == null || this._dt.Rows.Count == 0)
            {
                return(false);
            }
            DataTable dt = this._dt.Copy();

            dt.TableName = "经济指标统计结果";
            dt.Columns["DISTRICTNAME"].Caption = this.gridColumn1.Caption;
            dt.Columns["DISTRICTAREA"].Caption = this.gridColumn2.Caption;
            if (dt.Columns["NUMBER"] != null)
            {
                dt.Columns["NUMBER"].Caption = this.gridColumn3.Caption;
            }
            if (dt.Columns["AREA"] != null)
            {
                dt.Columns["AREA"].Caption = this.gridColumn4.Caption;
            }
            if (dt.Columns["FLOORAREA"] != null)
            {
                dt.Columns["FLOORAREA"].Caption = this.gridColumn5.Caption;
            }
            return(ExcelOper.ExportExcel(dt, path, false));
        }
        private void button_export_Click(object sender, RoutedEventArgs e)
        {
            if (obc_department.Count == 0)
            {
                return;
            }
            string filepath = "";

            SaveFile(ref filepath);
            if (string.IsNullOrEmpty(filepath))
            {
                return;
            }
            ExcelOper excel = new ExcelOper(filepath);

            try
            {
                foreach (DepartmentBudgetFilled depart in obc_department)
                {
                    excel.PrintOneDepartmentBudgetFilledBlock(depart);
                }
                MessageBox.Show("成功导出", "Information");
            }
            catch (Exception)
            { }
            finally {
                excel.Save();
                excel.Quit();
            }
        }
Exemplo n.º 6
0
        private bool ExportToExcel(string path)
        {
            if (this._dt == null || this._dt.Rows.Count == 0)
            {
                return(false);
            }
            DataTable dt = this._dt.Copy();

            dt.TableName = "区域要素属性统计表";
            return(ExcelOper.ExportExcel(dt, path, false));
        }
Exemplo n.º 7
0
        private void btnOutputExcel_Click(object sender, EventArgs e)
        {
            if (this._dt == null || this._dt.Rows.Count == 0)
            {
                return;
            }
            SaveFileDialog dialog = new SaveFileDialog
            {
                RestoreDirectory = true,
                Filter           = "Excel Files (*.xls)|*.xls"
            };

            if (DialogResult.OK == dialog.ShowDialog())
            {
                string fileName = dialog.FileName;

                DataTable dt = this._dt.Copy();
                dt.TableName = this.seLimitHeight.Value.ToString("0.00") + "m限高结果表";
                dt.Columns["Name"].Caption          = "名称";
                dt.Columns["fcName"].Caption        = "类型";
                dt.Columns["OverHeight"].Caption    = "超高(m)";
                dt.Columns["TerrainHeight"].Caption = "地面高(m)";
                dt.Columns["Height"].Caption        = "高度(m)";
                dt.Columns["Address"].Caption       = "地址";
                dt.Columns["Contact"].Caption       = "联系人";
                dt.Columns.Remove("fid");
                dt.Columns.Remove("fc");
                dt.Columns.Remove("geo");

                WaitForm.Start("正在导出...", "请稍后");
                bool bExport = ExcelOper.ExportExcel(dt, fileName);
                if (bExport)
                {
                    WaitForm.Stop();
                    XtraMessageBox.Show("导出成功", "提示");
                }
                else
                {
                    WaitForm.Stop();
                    XtraMessageBox.Show("导出失败", "提示");
                }
            }
        }
Exemplo n.º 8
0
        private bool ExportToExcel(string path)
        {
            if (this._dt == null || this._dt.Rows.Count == 0)
            {
                return(false);
            }
            DataTable dt = this._dt.Copy();

            dt.TableName = "管点统计结果";
            dt.Columns["PIPENODETYPE"].Caption = "管点类型";
            dt.Columns["FIELDNAME"].Caption    = "属性";
            dt.Columns["PVALUE"].Caption       = "分类";
            dt.Columns["NUMBER"].Caption       = "数量(个)";
            dt.Columns["TOTALNUMBER"].Caption  = "总数量(个)";
            if (!this.gridColumn2.Visible)
            {
                dt.Columns.Remove("FIELDNAME");
            }
            return(ExcelOper.ExportExcel(dt, path, true));
        }
Exemplo n.º 9
0
        //检查文件内容
        private void CheckFileInOBC(ImportDGViewModel dGViewModel)
        {
            if (!File.Exists(dGViewModel.FilePath))
            {
                dGViewModel.Comment = "File Not Exists";
                return;
            }

            ExcelOper excel = new ExcelOper(dGViewModel.FilePath);

            try
            {
                // CsvHelper csv = new CsvHelper();

                //DataTable dt = csv.readCsvTxt(dGViewModel.FilePath);
                DataTable dt = excel.GetContentFromExcel();
                if (dt.DefaultView[5][1].ToString().Trim() == "Ag")
                {
                    dGViewModel.CsvType = "Ag";
                }
                else if (dt.DefaultView[5][1].ToString().Trim() == "W")
                {
                    dGViewModel.CsvType = "W";
                }
                else
                {
                    dGViewModel.Comment = "未能识别文件内容";
                    return;
                }
                dGViewModel.SampleComment = dt.DefaultView[3][1].ToString();
                dGViewModel.Csv_VM        = new CSVValueViewModel();
                dGViewModel.Csv_VM        = CSVVM(dGViewModel.CsvType, dt);
                dGViewModel.FileDir       = dGViewModel.Csv_VM.FileDir;
            }
            catch (Exception)
            {
                dGViewModel.Comment = "未能识别文件内容";
                return;
            }
            finally { excel.Quit(); }
        }
        private void button_export_Click(object sender, RoutedEventArgs e)
        {
            if (obc_import.Count == 0)
            {
                return;
            }
            string filepath = "";

            SaveFile(ref filepath);
            if (string.IsNullOrEmpty(filepath))
            {
                return;
            }
            ExcelOper excel = new ExcelOper(filepath);

            foreach (ProjectImportMouldViewModel import in obc_import)
            {
                excel.PrintOneImportBlock(import);
            }
            excel.Save();
            excel.Quit();
            MessageBox.Show("成功导出", "Information");
        }