Excel Interop C#:我想 select 具有彩色背景的单元格范围作为 Excel 范围
Excel Interop C#: I want to select a range of cells with colored background as ExcelRange
我想 select 一系列单元格使用 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]);
}
}
}
我想 select 一系列单元格使用 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]);
}
}
}