Example usage for org.apache.poi.xssf.usermodel.extensions XSSFCellFill getFillBackgroundColor

List of usage examples for org.apache.poi.xssf.usermodel.extensions XSSFCellFill getFillBackgroundColor

Introduction

In this page you can find the example usage for org.apache.poi.xssf.usermodel.extensions XSSFCellFill getFillBackgroundColor.

Prototype

public XSSFColor getFillBackgroundColor() 

Source Link

Document

Get the background fill color.

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  ww  w. j av a 2 s.  co m*/
    XSSFColor fillBackgroundColor = fg.getFillBackgroundColor();
    if (fillForegroundColor == null) {
        if (fillBackgroundColor != null && _theme != null) {
            _theme.inheritFromThemeAsRequired(fillBackgroundColor);
        }
        return fillBackgroundColor;
    } else {
        return fillForegroundColor;
    }
}