Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Microsoft Office
Developer Web Components
Import Excel file into OWC11 in .net 2
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="jpandviv, post: 6948913"] Ok. Here it goes... Background: I'm trying to allow my user to load a local Excel file into and OWC11 spreadsheet control and modify it before uploading it into a database. What I have done so far: I have been able to place a spreadsheet control on the aspx form. I also have the code in place that will allow the user to find an Excel file and load it into an OWC control (server-side I think). code-behind in import.aspx.vb: Protected Sub LoadSheet() Dim o_Sheet As New Microsoft.Office.Interop.Owc11.Spreadsheet Dim i_Cols As Integer Dim i_Rows As Integer Dim IntICol As Integer Dim o_EXsheet As Excel.Worksheet Dim o_EXapp As Excel.Application Dim o_EXwbk As Excel.Workbook Dim i As Integer o_EXapp = New Excel.Application o_EXwbk = o_EXapp.Workbooks.Open(Filename:=ImportFileCtrl.PostedFile.FileName) o_EXsheet = CType(o_EXwbk.Worksheets(1), Excel.Worksheet) i_Rows = o_EXsheet.UsedRange.Rows.Count i_Cols = o_EXsheet.UsedRange.Columns.Count o_Sheet.Rows.Clear() o_Sheet.Columns.Clear() o_Sheet.TitleBar.Caption = ImportFileCtrl.FileName For i = 1 To i_Rows For IntICol = 1 To i_Cols o_Sheet.ActiveSheet.Cells(i, IntICol).Value = Trim(o_EXsheet.Cells(i, IntICol).value & "") Next Next 'ImportGrid = o_Sheet <-- commented out because I get an error here o_EXwbk.Close("No") o_EXapp.Quit() MsgBox("Finished Uploading Roster", vbOKOnly, "NASCC Roster Upload") End Sub object declaration on the form: <object id="ImportGrid" classid="CLSID:0002E559-0000-0000-C000-000000000046" style="z-index: 109; left: 18px; width: 621px; position: absolute; top: 146px; height: 192px" name="ImportGrid"> </object> I think I'm running into a server-side/client-side issue, but I'm not sure. Basically, I'm looking for a way to bind the data I loaded in the procedure to the control I placed on the form. Is this possible? Can someone out there in asp-land please tell me what I'm doing wrong. Your help is appreciated more than you know. Regards. [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Microsoft Office
Developer Web Components
Import Excel file into OWC11 in .net 2
Top