The argument in setTabColor is a color index but in XSSF color can be
set in other form: it can be either a indexed color or RGB or a color
from theme.
You should check what is returned by worksheet.getSheetPr().getTabColor().

The implementation sketch ois something like this:

    public int getTabColor(){
        CTSheetPr pr = worksheet.getSheetPr();
        if(pr == null || pr.isSetTabColor()) {
            // default tab color is white
            return IndexedColors.WHITE.index;
        }
        CTColor color = pr.getTabColor();
        if(color.isSetIndexed()) {
            return (int)color.getIndexed();
        }  else if (color.isSetRgb()){
            byte[] rgb = color.getRgb();
            // find closest matching color in IndexedColors
            // re-use logic from  HSSFPallete#findSimilarColor
            return closetMatch;
        } else if(color.isSetTheme()){
            // convert to indexed color
        }

    }

Yegor


On Sat, Dec 22, 2012 at 5:48 AM, Stuart Turner <[email protected]> wrote:
> XSSFSheet has a method to set the color of a tab but it doesn't have
> the ability to get the color of a tab.
>
> I wrote a quick implementation in XSSFSheet, based on how the
> setTabColor method works, but it does not obtain the sheet's tab
> color.
>
> Can someone guide me on what needs to be done in order to add this
> functionality please?
>
> Thanks
>
> Stuart
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to