![](/img/trans.png)
[英]How to determine which cells in a merged range are visible and can have a value?
[英]How to tell if my range of cells is visible
以下代碼用於處理用戶選擇的一系列單元格:
ForEach (var cell in sheet.Range[string.Format("A{0}:A{1}", row1, row2)].Cells)
{
// if this cell contains a specific value do something with the row
if((cell.Value ?? "").ToString() == "1")
{
// ...
}
}
問題是,范圍中的某些行可能已被過濾器隱藏。
如何確保僅處理可見的單元格?
If Not sheet.Range(cell, cell).Hidden Then
...
在VB.Net中。 似乎無法找到Cell
對象是否具有隱藏屬性,但Range
對象卻具有。 根據MSDN,它返回一個布爾值作為對象類型。 應該足夠容易轉換為C#,但我對它還不夠熟悉,無法舒適地發布使用它的解決方案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.