zoukankan      html  css  js  c++  java
  • 导出EXCEL

     #region 导出EXCEL
            /// <summary>
            /// 导出EXCEL
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void btnF1_Click(object sender, EventArgs e)
            {
                if (this.gvRM_ALARM_INFO.RowCount > 0)
                {
                  
                    using (SaveFileDialog fd = new SaveFileDialog())
                    {
                        fd.Title = "导出Excel文件";
                        fd.RestoreDirectory = true;
                        fd.Filter = "Excel文件|*.xls";
                        fd.FilterIndex = 1;
                        if (fd.ShowDialog() == DialogResult.OK)
                        {
                            gvRM_ALARM_INFO.ExportToXls(fd.FileName);
                            MessageBox.Show("文件导出成功!", "导出提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("当前没有可以导出的记录!", "导出Excel", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                this.operate_flag = "F1";
            }
            #endregion
  • 相关阅读:
    sudo命令 sudoers文件
    sscanf函数
    printf格式化输出
    c文件操作
    string和char*
    c去除空格 小写转大写
    主机序和网络序转换
    ulimit用法
    mysql基础(附具体操作代码)
    ES6 class
  • 原文地址:https://www.cnblogs.com/gaohao/p/3630813.html
Copyright © 2011-2022 走看看