excel - "Open an existing file in Spreadsheetgear using VB.Net -
I am trying to open an existing file in WorkBookView
(named WkbMain
in the code given below) I have been using the following code on my windows form:
Private sub MenuItemOpen_Click (as the object, in the form of e EventArgs Try slow lObjDialog New OpenFileDialog () as wkbMain.GetLock () then try lObjDialog.ShowDialog () = DialogResult.OK then wkbMain = SpreadsheetGear.Factory.GetWorkbook (lObjDialog.FileName, System.Globalization.CultureInfo.CurrentCulture) East In the end, try wkbMain.ReleaseLock () end end as the exception
but if the job
wkbMain = SpreadsheetGear.Factory.GetWorkbook (lObjDialog. FileName, System.Globalization.CultureInfo.CurrentCulture) `)
throws an exception:
to type 'SpreadsheetGear.Windows.Forms.WorkbookView Unable to cast a type of 'ᢷ' type.
Please suggest a solution
Setting a Workbook View Will happen. The property property obtained by Factory.GetWorkbook (...), not your own example on the workbook item:
wkbMain.ActiveWorkbook = SpreadsheetGear.Factory.GetWorkbook (lObjDialog.FileName, System.Globalization. CultureInfo.CurrentCulture))
Comments
Post a Comment