/// <summary> /// Opens a new spreadsheet form. /// </summary> private void OpenFile() { OpenFileDialog openSS = new OpenFileDialog(); openSS.InitialDirectory = "c:\\"; openSS.Filter = "Spreadsheet File (*.sprd)| *.sprd | All Files (*.*)|*.*"; openSS.DefaultExt = "sprd"; DialogResult r = openSS.ShowDialog(); if (r == DialogResult.OK) { filename = openSS.FileName; try { Form1 temp = new Form1(openSS.FileName); temp.s = new Spreadsheet(filename, s => true, s => s.ToUpper(), "ps6"); SpreadSheetApplicationContext.getAppContext().DisplayForm(temp); HashSet <string> HashNames = new HashSet <string>(temp.s.GetNamesOfAllNonemptyCells()); foreach (string cell in HashNames) { GetAddressOfCell(cell); temp.spreadsheetPanel1.SetValue(column, row, cellValue(cell).ToString()); } temp.DisplaySelection(temp.spreadsheetPanel1); } catch (IOException) { MessageBox.Show("Cannot open File"); } } }