private void OnImportEXCEL(object _type) { if (_type == null) { return; } NodesToExcelExportType type = NodeAssembler.StringToType(_type.ToString()); try { var dlg = new Microsoft.Win32.OpenFileDialog() { Filter = "excel files|*.xls;*.xlsx" }; // this causes a Securiy Exception (SQLite) if the propgram is not run as Administrator, // but it has no effect on the rest if (dlg.ShowDialog().Value) { if (File.Exists(dlg.FileName)) { // get the name of the table string tablename = "Tabelle1"; Window window = Application.Current.MainWindow; if (window != null) { MainWindow mw = window as MainWindow; if (mw != null) { tablename = mw.OpenTableNameWindow(); } } //imports the EXCEL file ExcelImporter excelImp = new ExcelImporter(); List <List <string> > raw_data = excelImp.ImportFromFile(dlg.FileName, tablename, 1000); // extract the data switch (type) { case NodesToExcelExportType.COMPLETE: this.imported_node_list = NodeAssembler.GetNodeListComplete(raw_data); break; case NodesToExcelExportType.EXPLICIT: this.imported_node_list = NodeAssembler.GetNodeListExplicit(raw_data); break; default: this.imported_node_list = NodeAssembler.GetNodeList(raw_data); break; } // attach to the nodemanager NodeAssembler.AttachNodesToNodeManager(this.imported_node_list, ref this.NManager); // publish to GUI this.OnRefreshTree(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "EXCEL File Import Error", MessageBoxButton.OK, MessageBoxImage.Error); // MessageBox.Show(ex.StackTrace, "EXCEL File Import Error", MessageBoxButton.OK, MessageBoxImage.Error); } }