vb.net - Read data from excel in asp.net -


i want read whole excel sheet's data in single textbox.

is possible?

i know code read cell's data excel textbox.

privatesub button18_click(byval sender system.object, byval e system.eventargs) handles button18.click      dim xlatest excel.application = ctype(createobject("excel.application"), excel.application)     xlatest.visible = true     dim wbktest excel.workbook = xlatest.workbooks.open("d:\tests\vbtrials\exceltests\testworkbook.xls")     dim wshtest excel.worksheet = directcast(wbktest.worksheets("sheet1"), excel.worksheet)     textbox1.text = wshtest.range("b2").value     wbktest.close()     xlatest.quit()  endsub 

private list<object> excelvoider()         {             excel.application xlapp = new excel.application();             excel.workbook xlworkbook = xlapp.workbooks.open(@"c:/temp/Книга1.xlsx");             excel._worksheet xlworksheet = xlworkbook.sheets[1];             excel.range xlrange = xlworksheet.range["b3", "q58"];             list<object> stroke = new list<object>();             int rowcount = xlrange.rows.count;             int colcount = xlrange.columns.count;             (int = 1; <= rowcount; i++)             {                 (int j = 1; j <= colcount; i++)                 {                       stroke.add(xlrange.value2[i, j]);                 }             }             return stroke;         } 

this range 1 cell another:

excel.range xlrange = xlworksheet.range["b3", "q58"]; 

you can use xlworksheet.usedrange.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -