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

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -