How to get the value of a merged cell using c#

I

Issac

Hi,
Is there a standard way to get the value of a merged cell using c#?

I tried both
1) target.Text
and
2) object[,] arr =
(object[,])target.get_Value(XlRangeValueDataType.xlRangeValueDefault);
if (null != arr)
ret = Convert.ToString(arr[1, 1]);

If I used method 1), sometimes I got empty string back even though the
value is not an empty string.
If I used method 2), sometimes I got an exception even though the cell
has value.

Any thoughts?

Thanks.
 
P

Peter T

try
target.MergeArea(1,1).Value

or .Text if you want a string of the value as formatted and displayed

Regards,
Peter T
 
Top