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