[英]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 我看了这个问题: 如何使用MS Interop Excel在C#中检测合并的单元格
But that is to tell you if a given range has merged cells. 但这是告诉您给定范围是否已合并单元格。
There is no Cell
type. 没有
Cell
类型。 A single cell is a Range
, just like lots of cells. 像许多单元格一样,单个单元格是一个
Range
。
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. 因此,适用相同的方法:
YourCell.MergeCells
是一个布尔属性,对于合并范围等于true,而YourCell.MergeArea
是所述合并范围。
MergeArea
always returns a value. MergeArea
始终返回一个值。 If the cell is merged with no other cells, then it returns the cell (again typed Range
) itself. 如果该单元格没有与其他任何单元格合并,则它将返回该单元格(再次键入
Range
)本身。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.