问题
I've been searching for this but I couldn't find a solution.
I have a workbook and I have to check if a cell has the Excel Gold color as background.
something like:
if(cell.getCellStyle().getFillForegroundColorColor().equals(gold) ){ then do something
I tried with HSSF and RGB colors but I can't get it work.
I really apreciate some help.
THanks!
回答1:
You can use
if(cell.getCellStyle().getFillForegroundColor()==HSSFColor.GOLD.index){
//do whatever you want
}
回答2:
this should work:
if(cell.getCellStyle().getFillForegroundColor().equals(HSSFColor.GOLD) )
{
}
来源:https://stackoverflow.com/questions/17221082/java-apache-poi-detect-cell-bakground-gold-color