public void SaveAs(string fileRootedPath, ExcelWorkbookFileVersion workbookFileVersion, bool overwrite) { if (overwrite && File.Exists(fileRootedPath)) { File.Delete(fileRootedPath); } XL.XlFileFormat format; switch (workbookFileVersion) { case ExcelWorkbookFileVersion.Excel2003: format = XL.XlFileFormat.xlExcel8; break; case ExcelWorkbookFileVersion.Excel2007OrLater: format = XL.XlFileFormat.xlOpenXMLWorkbook; break; default: throw new EnumerationValueUnhandledException(workbookFileVersion); } this.XlWorkbook.SaveAs(fileRootedPath, format, Missing.Value, Missing.Value, Missing.Value, Missing.Value, XL.XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); }
public void SaveAs(string fileRootedPath, ExcelWorkbookFileVersion workbookFileVersion) { SaveAs(fileRootedPath, workbookFileVersion, true); }