Ejemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ucCalcHeatCondition1_ExportEvent(object sender, EventArgs e)
        {
            string filename = CZGRCommon.Path.GetTempFileName("xls");
            DataFormatterCollection dfs = new DataFormatterCollection();
            dfs.Add(new SingleFormatter());
            dfs.Add(new DoubleFormatter());
            dfs.Add(new Int32Formatter());
            CZGRCommon.ExcelExporter ee = new CZGRCommon.ExcelExporter(filename, dfs);

            // 耗热量计算公式
            //
            LinesAttache aaa = new LinesAttache();
            DataTable tbl = CZGRQRCApp.Default.DBI.ExecuteHeatCommentDataTable();
            List<III> iiis = CreateIIIs();
            CZGRCommon.CCC ccc = CreateCCC(iiis);

            aaa.Lines.Add("");
            aaa.Lines.Add("注:");

            foreach (DataRow row in tbl.Rows)
            {
                string content = row["content"].ToString().Trim();
                if (content.Length > 0)
                {
                    aaa.Lines.Add(content);
                }
            }
            //aaa.Lines.Add("\t注:日耗热量 = 日流量 * ( 一次供温 - 一次回温 ) * 4.1816 / 1000");

            ee.AttacheCollection.Add(aaa);

            ee.Export(this.dataGridView1, ccc);

            ProcessStartInfo si = new ProcessStartInfo(filename);
            si.ErrorDialog = true;
            Process.Start(si);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnExport_Click(object sender, EventArgs e)
        {
            string filename = CZGRCommon.Path.GetTempFileName("xls");
            CZGRCommon.ExcelExporter ee = new CZGRCommon.ExcelExporter(filename,
                //GetDataFormatterCollection());
                DataGridViewFormatters.DefaultDataFormatterCollection);

            ee.ExportedEvent += new EventHandler(ee_ExportedEvent);
            CCC ccc = CCCFactory.CreateGRDataCCC(this.dataGridView1);
            ee.Export(this.dataGridView1, ccc);

            ProcessStartInfo si = new ProcessStartInfo(filename);
            si.ErrorDialog = true;
            Process.Start(si);
        }