diff options
author | Serghei Cebotari <51533848+schebotar@users.noreply.github.com> | 2022-01-09 15:48:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-09 15:48:16 +0300 |
commit | bca7f64880bdbcade4a613c8223f82353a326b44 (patch) | |
tree | d14ea8875b8b348c1f3e03256ec304ea992d635f /src/Forms/Dialog.cs | |
parent | 72908aaaf7da74fe1b3de4d939faaf829d4a80e2 (diff) | |
parent | 846547d6d905e0dbee73cd9c62760ea43bb88134 (diff) |
Merge pull request #11 from schebotar/dev
Dev
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); + } } } |