How can i count Vertical merged cells. i.e cells merged in column 1 vertically, top to bottom.?
Hi,
I'm not sure what you mean. Do you want the count the number of cells merged into one cell? Or you want to count the total number of merged cell in the column?
The former is fairly easy. The cell has a GetMergedCells method which will return an array containing all the cells that are merged into the mergecell with itself.
The latter would be more difficult and you would probably have to loop through each row and use GetMergedCells to determine how many rows to skip before looking at the next cell.
I have a column name called "Enterprise" in which the cells are merged vertically (row wise). I want to display the merged count against each merged cell. eg.
Enterprise column1 column2
ABN(3) A B
A B
C D
Bank(2) B L
C O
and so on.
Is it possible and if yes, then how?
This is a bit tricky. I assume that you just want to change the display of the cell, not the underlying value of the merged cells. So you would have to use either a DrawFilter or a CreationFilter for this. I'd probably go with the CreationFilter myself. That way you can trap for the creation of a MergedCellUIElement and then just set the Text property on the element itself.