POI 中Cell的backgroundcolor和foregroundcolor

来源:互联网 发布:室内装修绘图软件 编辑:程序博客网 时间:2024/04/27 17:42

刚开始以为要获得cell的背景色是使用  getFillBackgroundColor()这个函数(这里返回的是调色板的索引,要获得RGB需要先获得系统的Pallete,然后在获得RGB)。结果出来的索引都是一样的,搜索了好一会,发现都没有自己要的答案,想想自己估计又犯了什么低级错误了,这个问题应该不是什么问题。果然在POI的文档里面,这个问题就已经陈述出来了:

public short getFillBackgroundColor()
Get the background fill color. Note - many cells are actually filled with a foreground fill, not a background fill - seegetFillForegroundColor()

public short getFillForegroundColor()
Get the foreground fill color. Many cells are filled with this, instead of a background color (getFillBackgroundColor())


这里写到许多cell其实是使用前景来填充的,而不是背景填充,所以应该要用getFillForegroundColor这个函数。当然目前还不是很了解background fill 和foreground fill。



原创粉丝点击