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

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

Introduction

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

Prototype

public XSSFColor getFillForegroundColor() 

Source Link

Document

Get the foreground 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  w w  w .j a v a 2s. c o m
    XSSFColor fillBackgroundColor = fg.getFillBackgroundColor();
    if (fillForegroundColor == null) {
        if (fillBackgroundColor != null && _theme != null) {
            _theme.inheritFromThemeAsRequired(fillBackgroundColor);
        }
        return fillBackgroundColor;
    } else {
        return fillForegroundColor;
    }
}