简体   繁体   English

C#和Microsoft.Office.Interop.Excel查找与给定单元格合并的所有单元格

[英]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.

相关问题 C#使用Microsoft.Office.Interop.Excel读取Excel单元格值 - C# reading Excel cell values using Microsoft.Office.Interop.Excel COMException C#Microsoft.Office.Interop.Excel - COMException C# Microsoft.Office.Interop.Excel C#MergeArea错误Microsoft.office.interop.excel - C# MergeArea Error Microsoft.office.interop.excel C# microsoft.office.interop.excel 添加图表 - C# microsoft.office.interop.excel Add Chart 如何使用C#Excel“Microsoft.Office.Interop.Excel”来计算一列中非空单元格的数量 - How can I use C# Excel “Microsoft.Office.Interop.Excel”, to count the amount of not empty cells in a one columns 如何使用Microsoft.Office.Interop.Excel动态增加单元格 - how to increment cells dynamically with Microsoft.Office.Interop.Excel Microsoft.Office.Interop.Excel 添加单元格很慢 - Microsoft.Office.Interop.Excel Adding cell is very slow Microsoft.Office.Interop.Excel:如何将边框应用到一个单元格 - Microsoft.Office.Interop.Excel: How to Apply a border to ONE CELL 如何在 C# 中使用 Microsoft.Office.Interop.Excel 在 Excel 中的矩形内写入文本 - How to write a text inside a rectangle in excel using Microsoft.Office.Interop.Excel in c# 如何在不使用 Microsoft.Office.Interop.Excel 库的情况下在 C# 中读取 excel 文件 - How to read an excel file in C# without using Microsoft.Office.Interop.Excel libraries
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM