Change Excel SaveAs to Windows Forms SaveFileDialog
This commit is contained in:
parent
120eee0231
commit
7f3487d913
@ -46,17 +46,22 @@ namespace RehauSku.Interface
|
|||||||
|
|
||||||
public static void SaveWorkbookAs()
|
public static void SaveWorkbookAs()
|
||||||
{
|
{
|
||||||
Workbook wb = AddIn.Excel.ActiveWorkbook;
|
Workbook workbook = AddIn.Excel.ActiveWorkbook;
|
||||||
string currentFilename = wb.FullName;
|
|
||||||
string fileFilter = "Файлы Excel (*.xls;*.xlsx;*.xlsm),*.xls;*.xlsx;*.xlsm";
|
|
||||||
|
|
||||||
object fileName = AddIn.Excel.GetSaveAsFilename(currentFilename, fileFilter);
|
using (SaveFileDialog dialog = new SaveFileDialog())
|
||||||
|
{
|
||||||
|
dialog.FileName = workbook.Name;
|
||||||
|
dialog.Filter = "Файлы Excel (*.xls;*.xlsx;*.xlsm)|*.xls;*.xlsx;*.xlsm";
|
||||||
|
|
||||||
if (fileName.GetType() == typeof(string))
|
if (dialog.ShowDialog() == DialogResult.Cancel)
|
||||||
wb.SaveAs(fileName);
|
{
|
||||||
|
workbook.Close(false);
|
||||||
|
}
|
||||||
|
|
||||||
else
|
string fileName = dialog.FileName;
|
||||||
wb.Close(false);
|
|
||||||
|
workbook.SaveAs(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user