保存Excel文件

         /// <summary>
        /// 保存Excel文件
        /// </summary>
        public void SaveExcel()
        {
            if (string.IsNullOrEmpty(strFilePathAndFileName))
            {
                MessageBox.Show("操作有误,请联系管理员!");
            }
            else
            {
                try
                {

                    wbb.SaveAs(strFilePathAndFileName, Microsoft.Office.Interop.Excel.XlFileFormat.xlHtml, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

                }
                catch (Exception)
                {

                    MessageBox.Show("操作有误,请联系管理员!");
                }

            }
        }

原文地址:https://www.cnblogs.com/ok519/p/1570946.html