Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get the value of a merged cell using c#
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.xlRangeValu eDefault); 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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get the value of a merged cell using c#
try
target.MergeArea(1,1).Value or .Text if you want a string of the value as formatted and displayed Regards, Peter T "Issac" wrote in message ... 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.xlRangeValu eDefault); 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Autofit Merged cell Code is changing the format of my merged cells | Excel Discussion (Misc queries) | |||
Very Basic Problem - Merged Cell Equals Contents of a Single Cell | Excel Worksheet Functions | |||
how do i link merged cells to a merged cell in another worksheet. | Excel Worksheet Functions | |||
How to copy single cell into cell that is merged from two cells? | Excel Discussion (Misc queries) | |||
Sorting merged cellsHow do I sort merged cells not identically siz | Excel Worksheet Functions |