Java(Apache POI)检测单元格背景金色 [英] Java (Apache POI) Detect cell bakground gold color

查看:151
本文介绍了Java(Apache POI)检测单元格背景金色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在搜索,但是找不到解决方案.

I've been searching for this but I couldn't find a solution.

我有一个工作簿,我必须检查一个单元格是否具有Excel Gold颜色作为背景.

I have a workbook and I have to check if a cell has the Excel Gold color as background.

类似:

if(cell.getCellStyle().getFillForegroundColorColor().equals(gold) ){ then do something

我尝试使用HSSF和RGB颜色,但无法正常工作.

I tried with HSSF and RGB colors but I can't get it work.

我真的很感谢您.

谢谢!

推荐答案

您可以使用

 if(cell.getCellStyle().getFillForegroundColor()==HSSFColor.GOLD.index){
   //do whatever you want
 }

这篇关于Java(Apache POI)检测单元格背景金色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆