read Merged Cells

Jul 11, 2014 at 11:15 PM
How can I read the value from merged cells on an excel file??

I have this code but send me a indedx out of limit error
var enu = worksheet.Cells["A3:D3"].Value;
Jul 14, 2014 at 6:13 AM
The values in merged cells are stored in 2d arrays e.g. object[,].

To access the value just grab the first value from the array e.g. [0,0];

v.quick example
var enu = (worksheet.Cells["A3:D3"].Value as object[,])[0,0].ToString();
Jul 14, 2014 at 6:51 PM
Actually I found the error but it's a little weird,
this error comes when the merged cell or any other single cell is partially formatted


"normal data, formatted data"
on this case is when I get the error did anybody know how can be solved?