简体   繁体   English

使用Apache POI将颜色应用于Excel中的选项卡

[英]Apply color to tabs in excel using apache poi

Is there any way by which tabs can be given specific colors using apache poi through java?. 是否可以通过Java通过apache poi通过任何方式为选项卡指定特定颜色? I am using HSSF workbook. 我正在使用HSSF工作簿。

You can change the sheet tab color using following: 您可以使用以下方法更改工作表标签的颜色:

sheet.setTabColor(int colorIndex) 

is used for that, and so if we use 用于此,所以如果我们使用

 sheet.setTabColor(ColorNum);

ColorNum = 0 : set Black Color in tab. ColorNum = 0:在选项卡中设置黑色。

ColorNum = 1 : set White Color in tab. ColorNum = 1:在选项卡中设置白色。

ColorNum = 2 : set Red Color in tab. ColorNum = 2:在选项卡中设置红色。

ColorNum = 3 : set Green Color in tab. ColorNum = 3:在选项卡中设置绿色。

ColorNum = 4 : set Blue Color in tab. ColorNum = 4:在选项卡中设置蓝色。

ColorNum = 5 : set Yellow Color in tab. ColorNum = 5:在选项卡中设置黄色。

and so on. 等等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM