执行时,怎会弹出一个对话框: 是否保存对“Sheet1”的更改现在,想去点提示框并且默认选择是,然后进行下一步的路径及名称的更改,,并且名称要默认成自己设置的而不是Sheet1public bool ExportByDs(ExcelDTO _ExcelDTO)
        {
            // 获取文件名
            String fileName = _ExcelDTO.fileName;            // 获取导出数据源
            DataSet ds = _ExcelDTO.ds;            // 参数传递不正确的场合,直接返回。
            if (ds == null || ds.Tables.Count == 0 || fileName == string.Empty)
            {
                return false;
            }            // 新建excel工作薄
            Application excel = new Application();
            Workbook work = excel.Workbooks.Add(true);            System.Data.DataTable table = ds.Tables[0];
            int rowindex = 1;
            int colindex = 0;            // 打印title
            foreach (DataColumn col in table.Columns)
            {
                colindex++;
                excel.Cells[1, colindex] = col.ColumnName;            }            // 打印data
            foreach (DataRow row in table.Rows)
            {
                rowindex++;
                colindex = 0;                foreach (DataColumn col in table.Columns)
                {
                    colindex++;
                    excel.Cells[rowindex, colindex] = row[col.ColumnName].ToString();
                }
            }            //Range a = excel.get_Range("A1", "'A'rowindex");
            //a.NumberFormatLocal = "@";            excel.Visible = false;
            try
            {
                excel.ActiveWorkbook.SaveCopyAs("fileName");
            }
            catch (Exception e)
            {            }
            finally
            {
                excel.Quit();
                excel = null;
                GC.Collect();
            }            return true;
        }