how to change the tab color of a worksheet with Apache Poi

前端 未结 3 962
粉色の甜心
粉色の甜心 2021-01-12 17:07

I am trying to set the background color of a worksheet tab using Apache POI. I can\'t seem to figure out how to set the style on the tabs themselves though.

Thanks f

3条回答
  •  迷失自我
    2021-01-12 17:30

    As commented by Alfabravo... it's possible now to change the XSSFSheet tab color.

    sheet.setTabColor(int colorIndex) 
    

    is used for that, and so if we use

     sheet.setTabColor(num);
    
    • num = 0 : set Black Color in tab.

    • num = 1 : set White Color in tab.

    • num = 2 : set Red Color in tab.

    • num = 3 : set Green Color in tab.

    • num = 4 : set Blue Color in tab.

    • num = 5 : set Yellow Color in tab.

    and so on.

提交回复
热议问题