Problem reading cell value

Hi,

I created an xlsx file filled with only the cells H1,H2,H3,H4.

I use

int XF = 0;

xls.GetCellValueIndexed(1,
8,ref XF);
 
 
The system threw an exception of type 'FlexCel.XlsAdapter.FlexCelXlsAdapterException' object {FlexCel.XlsAdapter.FlexCelXlsAdapterException}.
 
where am I doing wrong?
Regards,
Fornaciari Valerio

Hi,

GetCellValueIndexed only counts the used cells. In you example, as you have only column "H" filled, the index for column H would be 1 (the first non empty cell in row 1).
GetCellValueIndexed is an optimization for when you need to read all non empty values in a sheet, so you don't have to loop from column A to H if you only have data in H. But in your case, if you want to access a cell by row and column, just use:

xls.GetCellValue(1,8);

Regards,
   Adrian.