Example usage for org.apache.poi.xssf.model ThemesTable inheritFromThemeAsRequired

List of usage examples for org.apache.poi.xssf.model ThemesTable inheritFromThemeAsRequired

Introduction

In this page you can find the example usage for org.apache.poi.xssf.model ThemesTable inheritFromThemeAsRequired.

Prototype

@Override
public void inheritFromThemeAsRequired(XSSFColor color) 

Source Link

Document

If the colour is based on a theme, then inherit information (currently just colours) from it as required.

Usage

From source file:com.vaadin.addon.spreadsheet.XSSFColorConverter.java

License:Open Source License

private XSSFColor getFillColor(XSSFCellStyle cs) {
    final CTXf _cellXf = cs.getCoreXf();
    int fillIndex = (int) _cellXf.getFillId();
    XSSFCellFill fg = workbook.getStylesSource().getFillAt(fillIndex);

    ThemesTable _theme = workbook.getTheme();
    XSSFColor fillForegroundColor = fg.getFillForegroundColor();
    if (fillForegroundColor != null && _theme != null) {
        _theme.inheritFromThemeAsRequired(fillForegroundColor);
    }//from   w w  w  .  j  a va 2  s  . com
    XSSFColor fillBackgroundColor = fg.getFillBackgroundColor();
    if (fillForegroundColor == null) {
        if (fillBackgroundColor != null && _theme != null) {
            _theme.inheritFromThemeAsRequired(fillBackgroundColor);
        }
        return fillBackgroundColor;
    } else {
        return fillForegroundColor;
    }
}