iznevidelitsa
iznevidelitsa

Reputation: 133

C# and Microsoft.Office.Interop.Excel Find all cells merged with given cell

Given a single cell, I want to know the range of cells that are merged with it.

I have looked at this question: how to detect merged cells in c# using MS interop excel

But that is to tell you if a given range has merged cells.

Upvotes: 0

Views: 689

Answers (1)

FXD
FXD

Reputation: 2060

There is no Cell type. A single cell is a Range, just like lots of cells.

Therefore the same methods apply: YourCell.MergeCells is a boolean property equal to true for merge ranges and YourCell.MergeArea is the said merged range.

MergeArea always returns a value. If the cell is merged with no other cells, then it returns the cell (again typed Range) itself.

Upvotes: 1

Related Questions