c# - SpreadSheetGear WorkbookView - Cells -


i have spreadsheetgear workbookview in form. spreadsheetgear workbookview has filled excel file 10 rows , 10 columns. want data cells using code below:

 (int = 0; < cells.range.rowcount; i++)  {    (int j = 0; j < cells.range.columncount; j++)    {      arrlstworkbookview.add(cells[i, j].text);      arrlstoutputdata.add(cells[i, j].text);    }  } 

and debugger shows me rowcount = 1048576 instead of 10, , rowcount = 16384 instead of 10.

how resolve problem workbookview , take right number of rows , columns excel file rows should 10 , columns should 10.

you don't provide line of code indicates cells variable coming from, if getting row count of 1,048,576, indicates me cells came iworksheet.cells/range, both of represents cells in worksheet (a1:xfd1048576).

if trying iterate on smaller range within worksheet, you'd need specify range iworksheet.cells["a1_ref"] or iworksheet.cells[row1,col1,row2,col2]. example:

// following 2 lines equivalent irange cells = worksheet.cells["a1:j10"]; irange cells = worksheet.cells[0, 0, 9, 9]; // ...the rest of code... 

if want iterate through "used range" of worksheet want use iworksheet.usedrange instead. example:

irange cells = worksheet.usedrange; 

also, call range in cells.range.rowcount redundant, irange.range represents specified irange. use cells.rowcount.

you may consider looking through our documentation irange indexer (irange.item(…)), demonstrates number of different ways reference cells: http://www.spreadsheetgear.com/support/help/spreadsheetgear.net.7.0/#spreadsheetgear2012.core~spreadsheetgear.irange~item.html

disclaimer: work spreadsheetgear.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -