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


C# ExcelAccess.ShowExcel方法代码示例

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


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

示例1: ExportExcel

 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public static void ExportExcel(sdjl_26 obj) {
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\送电17防护通知书.xls";
     int sz = 30;//一行最多30个
     ex.Open(fname);
     //此处写填充内容代码
     ex.ActiveSheet(1);
     //通知单位
     ex.SetCellValue(obj.tzdw, 5, 1);
     //电压
     ex.SetCellValue(obj.lineVol, 6, 7);
     //线路
     ex.SetCellValue(obj.c1, 6, 9);
     //发现问题
     List<string> fxwtList = GetList(obj.fxwt, sz);
     for (int i = 0; i < fxwtList.Count; i++)
     {
         ex.SetCellValue(fxwtList[i], 7+i, 1);
         if (i > 1)
             break;
     }
     //处理措施
     List<string> clcsList = GetList(obj.clcs, sz);
     for (int i = 0; i < clcsList.Count; i++)
     {
         ex.SetCellValue(obj.clcs, 12+i, 1);
         if (i > 2)
             break;
     }
    
    ex.ShowExcel();
 }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:37,代码来源:ExportSD26.cs

示例2: barButtonItem2_ItemClick

        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
              SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = "";
            saveFileDialog1.Filter = "Microsoft Excel (*.xls)|*.xls";
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                fname = saveFileDialog1.FileName;
                try
                {
                    dsoFramerControl1.FileSave(saveFileDialog1.FileName, true);
                    if (MsgBox.ShowAskMessageBox("导出成功,是否打开该文档?") != DialogResult.OK)
                    {
                        ExcelAccess ex = new ExcelAccess();
                        ex.Open(fname);
                        //此处写填充内容代码

                        ex.ShowExcel();
                        return;
                    }
                }
                catch
                {
                    MsgBox.ShowSuccessfulMessageBox("无法保存" + fname + "。请用其他文件名保存文件,或将文件存至其他位置。");
                    return;
                }
            }
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:28,代码来源:frmSbnbTemplate.cs

示例3: ExportExcel10KV

        public static void ExportExcel10KV(IList<PS_kgjctj> datalist)
        {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\10KV用户供电可靠性基础数据统计表.xls";
            ex.Open(fname);

            int rowcount = 1;
            if (datalist.Count < 1) return;
            string tablename = "10KV用户供电可靠性基础数据统计表";
            if (tablename.Length > 30)
            {
                tablename = tablename.Substring(tablename.Length - 31);
            }
            //
            //加页
            int pageindex = datalist.Count;

            for (int j = 1; j < pageindex; j++)
            {
                ex.CopySheet(1, j);
                ex.ReNameWorkSheet(j + 1, tablename + "(" + (j) + ")");
            }
            for (int j = 0; j < datalist.Count; j++)
            {
                if (j == 0)
                {
                    ex.ActiveSheet(tablename);
                }
                else
                {
                    ex.ActiveSheet(tablename + "(" + j + ")");
                }
                // 填值
                ex.SetCellValue(datalist[j].OrgName, 3, 2);
                ex.SetCellValue(datalist[j].CreateTime.ToString("yyyy年MM月dd日"), 5, 9);
                ex.SetCellValue(datalist[j].kgModel, 5, 2);
                ex.SetCellValue(datalist[j].iscxkg == true ? "是" : "否", 5, 7);
                ex.SetCellValue(datalist[j].kgCode, 5, 9);
                ex.SetCellValue(datalist[j].jkdxcd, 10, 2);
                ex.SetCellValue(datalist[j].dlxlcd, 10, 7);
                ex.SetCellValue(datalist[j].publicusercount.ToString(), 11, 2);
                ex.SetCellValue(datalist[j].publicbtcount.ToString(), 11, 5);
                ex.SetCellValue(datalist[j].publicbtrlcount.ToString(), 11, 9);
                ex.SetCellValue(datalist[j].zyusercount.ToString(), 12, 2);
                ex.SetCellValue(datalist[j].zybtcount.ToString(), 12, 5);
                ex.SetCellValue(datalist[j].zybtrlcount.ToString(), 12, 9);

                ex.SetCellValue(datalist[j].sdyusercount.ToString(), 13, 2);
                ex.SetCellValue(datalist[j].sdyrlcount.ToString(), 13, 5);
                ex.SetCellValue(datalist[j].zyuserqtsbcount.ToString(), 13, 9);

                ex.SetCellValue(datalist[j].drqcount.ToString(), 14, 2);
                ex.SetCellValue(datalist[j].drqrl, 14, 5);
                ex.SetCellValue(datalist[j].zyuserqtsbrlcount.ToString(), 14, 9);
            }
            ex.ActiveSheet(tablename);
            ex.ShowExcel();
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:59,代码来源:Export12.cs

示例4: barButtonItem2_ItemClick

        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = "";
            saveFileDialog1.Filter = "Microsoft Excel (*.xls)|*.xls";


            if (saveFileDialog1.ShowDialog() == DialogResult.OK) {
                fname = saveFileDialog1.FileName;
                try {
                    dsoFramerControl1.FileSave(saveFileDialog1.FileName, true);
                    //dsoFramerControl1.Dispose();

                    //dsoExcelControl1.AxFramerControl.Save(fname,true,null,null);
                    // dsoExcelControl1.FileSaveAs(out fname);
                    //if (MsgBox.Show("导出成功!") != DialogResult.Yes)
                    //////MsgBox.Show("导出成功!");
                    //////dsoExcelControl1.AxFramerControl.Dispose();
                    //////return;

                    if (MsgBox.ShowAskMessageBox("导出成功,是否打开该文档?") != DialogResult.OK) {
                        //dsoExcelControl1.AxFramerControl.Dispose();
                        //dsoExcelControl1.Dispose();
                        ExcelAccess ex = new ExcelAccess();
                        //SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                        //string fname = Application.StartupPath + "\\00记录模板\\26防护通知书.xls";

                        ex.Open(fname);
                        //此处写填充内容代码

                        ex.ShowExcel();
                        //Microsoft.Office.Interop.Excel.Application exc = new Microsoft.Office.Interop.Excel.Application(); //引用Excel对象
                        //Microsoft.Office.Interop.Excel.Workbook book = exc.Application.Workbooks.Add(fname); //引用Excel工作簿
                        //exc.Visible = true; //使Excel可视
                        return;
                    }
                    //System.Diagnostics.Process.Start(fname);

                    //ExcelAccess ex = new ExcelAccess();
                    ////SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                    ////string fname = Application.StartupPath + "\\00记录模板\\26防护通知书.xls";

                    //ex.Open(fname);
                    ////此处写填充内容代码

                    //ex.ShowExcel();




                    //  System.Diagnostics.Process.Start(fname);
                } catch {
                    MsgBox.ShowSuccessfulMessageBox("无法保存" + fname + "。请用其他文件名保存文件,或将文件存至其他位置。");
                    return;
                }
            }
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:56,代码来源:frmSD23Template.cs

示例5: ExportExcel

        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public static void ExportExcel(object obj) {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\17线路条图.xls";

            ex.Open(fname);
            //此处写填充内容代码

           ex.ShowExcel();
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:14,代码来源:Export17.cs

示例6: ExportExcel

 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public static void ExportExcel(sdjl_23 obj)
 {
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\送电16电力设备产权、维护范围协议书.xls";
     if (obj.BigData != null)
     {
         if (obj.BigData.Length > 10)
         {
             fname = Path.GetTempPath() + "送电16电力设备产权、维护范围协议书.xls";
             //MemoryStream ms = new MemoryStream(obj.BigData);
             FileStream fs = new FileStream(fname, FileMode.OpenOrCreate);
             fs.Write(obj.BigData, 0, obj.BigData.Length);
             fs.Flush();
             fs.Close();
         }
     }
     ex.Open(fname);
     ex.SetCellValue(obj.jf, 5, 4);
     ex.SetCellValue(obj.xybh, 4, 11);
     ex.SetCellValue(obj.cqdw + ":", 6, 4);
     string linename = "";
     if (obj.linename.Contains("线"))
     {
         linename = obj.linename.Substring(0, obj.linename.LastIndexOf("线"));
     }
     else
         linename = obj.linename;
     string[] filtchar = { "V", "v" };
     for (int i = 0; i < filtchar.Length; i++)
     {
         if (linename.Contains(filtchar[i]))
         {
             linename = linename.Substring(linename.LastIndexOf(filtchar[i]) + 1);
         }
     }
     ex.SetCellValue(linename,9, 9);
     //string fzlinename = "";
     //if (obj.fzlinename.Contains("支"))
     //{
     //    fzlinename = obj.fzlinename.Substring(0, obj.fzlinename.LastIndexOf("支"));
     //}
     //else
     //    fzlinename = obj.fzlinename;
     //ex.SetCellValue(fzlinename, 10, 10);
     ex.SetCellValue(obj.cqfw, 10, 4);
     ex.SetCellValue("'" + obj.gh, 9, 12);
     ex.SetCellValue(obj.cqdw+"。", 12, 4);
     ex.SetCellValue(obj.jf, 11, 4);
     ex.SetCellValue(obj.qxydd, 15, 8);
     ex.SetCellValue(obj.qdrq.Year.ToString(), 21, 11);
     ex.SetCellValue(obj.qdrq.Month.ToString(), 21, 13);
     ex.SetCellValue(obj.qdrq.Day.ToString(), 21, 16);
     ex.ShowExcel();
 }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:59,代码来源:ExportSD23.cs

示例7: ExportExcel

 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public  void ExportExcel(IList<PJ_21dyjcdcbkchild> datalist)
 {
     //lgm
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\电压检测点抄表卡.xls";
     ex.Open(fname);
     ExportExcel(ex, datalist);
     ex.ShowExcel();
    
 }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:15,代码来源:ExportPJ_21dyjcdcbk.cs

示例8: ExportExcel

 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public  void ExportExcel(IList<PJ_tdjh> datalist)
 {
     //lgm
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\所月度停电计划.xls";
     ex.Open(fname);
     ExportExcel(DateTime.Now, ex, datalist);
     ex.ShowExcel();
    
 }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:15,代码来源:ExportJTDJH.cs

示例9: ExportExcelMonth

        public void ExportExcelMonth(string orgid)
        {
            //lgm
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\客户电力电容器台帐.xls";
            ex.Open(fname);
           
            ex.ShowExcel();

        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:11,代码来源:ExportKHDLDRQTZ.cs

示例10: ExportExcel

 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public  void ExportExcel(IList<PJ_sdytz> datalist)
 {
     //lgm
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\双电源台账.xls";
     ex.Open(fname);
     ExportExcel(ex, datalist);
     ex.ShowExcel();
    
 }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:15,代码来源:ExportSDY.cs

示例11: ExportExcel

 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public void ExportExcel(IList<PJ_clcrkd> datalist)
 {
     //lgm
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\生产台账.xls";
     ex.Open(fname);
     ExportExcel(ex, datalist, "生产物资管理生产台账");
     
     ex.DeleteSheet(1);
     ex.ShowExcel();
    
 }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:17,代码来源:ExportSCTZEdit.cs

示例12: ExportExcel

        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public void ExportExcel(string orgid) {
            //lgm
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\设备标志缺失变更明细表二.xls";
            ex.Open(fname);
            string filter = "where 1=1 ";
            if (orgid != "") filter += " and OrgCode='" + orgid + "'";
            IList<PJ_sbbzqsbgmxb2> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_sbbzqsbgmxb2>(
             filter

               );
            ExportExcel(ex, datalist, orgid);
            ex.ShowExcel();
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:19,代码来源:ExportSBBZQSBGMXB2Edit.cs

示例13: ExportExcel

 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public static void ExportExcel(PJ_23 obj)
 {
     ExcelAccess ex = new ExcelAccess();
     string fname = Application.StartupPath + "\\00记录模板\\23配电线路产权维护范围协议书.xls";
     if (obj.BigData != null && obj.BigData.Length > 10) {
         fname = Path.GetTempPath() + "23配电线路产权维护范围协议书.xls";
         //MemoryStream ms = new MemoryStream(obj.BigData);
         FileStream fs = new FileStream(fname, FileMode.OpenOrCreate);
         fs.Write(obj.BigData, 0, obj.BigData.Length);
         fs.Flush();
         fs.Close();
     }
     ex.Open(fname);
     ExportExcel(obj, ex);
     ex.ShowExcel();
 }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:20,代码来源:Export23.cs

示例14: ExportExcel

 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public void ExportExcel(string orgid)
 {
     //lgm
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\电压监测装置设置台帐.xls";
     ex.Open(fname);
    
         IList<PJ_dyjczzsztz> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_dyjczzsztz>(
            " where OrgCode='" + orgid + "' order by id"
            );
         ExportExcel(ex, datalist);
     
    
     ex.ShowExcel();
    
 }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:21,代码来源:ExportDYJCZZSZTZEdit.cs

示例15: ExportExcel

        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public static void ExportExcel(PJ_24 jl)
        {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\24设备变更通知书.xls";

            ex.Open(fname);
            int row = 1;
            int col = 1;
            //
            ex.SetCellValue(jl.sj.Year.ToString(), row + 8, col);
            ex.SetCellValue(jl.sj.Month.ToString(), row + 8, col+2);
            ex.SetCellValue(jl.sj.Day.ToString(), row + 8, col+4);
            ex.SetCellValue(jl.dd, row + 5, col+6);
            ex.SetCellValue(jl.nr, row + 5, col + 7);
            ex.SetCellValue(jl.Remark, row + 5, col + 10);

            ex.ShowExcel();
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:23,代码来源:Export24.cs


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