diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2022-01-09 15:47:54 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2022-01-09 15:47:54 +0300 |
commit | 846547d6d905e0dbee73cd9c62760ea43bb88134 (patch) | |
tree | d14ea8875b8b348c1f3e03256ec304ea992d635f /src/Forms/Dialog.cs | |
parent | 0c307e985faab3a1510beac3a4740354ef23f585 (diff) |
Add SaveAs Dialog after export
Diffstat (limited to 'src/Forms/Dialog.cs')
-rw-r--r-- | src/Forms/Dialog.cs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/Forms/Dialog.cs b/src/Forms/Dialog.cs index 170cc81..cc1c29a 100644 --- a/src/Forms/Dialog.cs +++ b/src/Forms/Dialog.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using Microsoft.Office.Interop.Excel; +using System.Collections.Generic; using System.Windows.Forms; namespace RehauSku.Forms @@ -42,5 +43,20 @@ namespace RehauSku.Forms return fileNames.ToArray(); } + + public static void SaveWorkbookAs() + { + Workbook wb = AddIn.Excel.ActiveWorkbook; + string currentFilename = wb.FullName; + string fileFilter = "Файлы Excel (*.xls;*.xlsx;*.xlsm),*.xls;*.xlsx;*.xlsm"; + + object fileName = AddIn.Excel.GetSaveAsFilename(currentFilename, fileFilter); + + if (fileName.GetType() == typeof(string)) + wb.SaveAs(fileName); + + else + wb.Close(false); + } } } |