簡體   English   中英

如何檢查工作表單元格中文本的顏色?

[英]How can I check the color of text in a cell of a worksheet?

如何檢查 C# epplus WPF 中的單元格文本顏色是白色還是其他顏色?

在 VBA 中,可以使用以下命令檢查單元格的顏色:

excelSheet.Cells(row,Column).Characters(1, 1).Font.Color <> vbWhite

如何使用 epplus 進行等效操作?

也許這會幫助您更深入地了解它:

在 EPPlus 中,您使用富文本,類似這樣(代碼未經測試)

if (dataSheet.Cells[1, 1].IsRichText)
{
var x = dataSheet.Cells[1, 1].RichText;
foreach (var g in x) // you will only need the first i think
{
if (g.Color == System.Drawing.Color.White)
{
// Do something
}
}
}

暫無
暫無

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

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