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

前端 未结 3 1001
粉色の甜心
粉色の甜心 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:13

    As commented by Piotr,
    to color tabs in POI 3.11 i had to use:

    import org.apache.poi.ss.usermodel.IndexedColors;
    sheet.setTabColor(IndexedColors.BLACK.getIndex());
    

    (Note that it is "IndexedColors", not "IndexedColor" like showed by Piotr.)
    here is a list showing the colors: http://jlcon.iteye.com/blog/1122538

提交回复
热议问题