簡體   English   中英

Excel Interop C#:我想選擇一個帶有彩色背景的單元格區域作為ExcelRange

[英]Excel Interop C#: I want to select a range of cells with colored background as ExcelRange

我想使用Excel Interop C#選擇一個單元格范圍,其背景顏色為“ LightBlue”。 我怎么做。

嘗試

    Microsoft.Office.Interop.Excel._Worksheet worksheet;
    int endColumn = 16384;
    int endRow = 65536;
    var results= new List<Excel.Range>();
    for(var i=0;i<=endColumn;i++)
    {
       for(var j=0;j<=endRow;j++)
       {  
          if(worksheet.Cells[j,i].Interior.Color ==   System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.LightBlue))
         {
          result.Add(worksheet.Cells[j,i]);
         }
       }
     }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM