Example usage for org.apache.poi.hssf.usermodel HSSFSheetConditionalFormatting getNumConditionalFormattings

List of usage examples for org.apache.poi.hssf.usermodel HSSFSheetConditionalFormatting getNumConditionalFormattings

Introduction

In this page you can find the example usage for org.apache.poi.hssf.usermodel HSSFSheetConditionalFormatting getNumConditionalFormattings.

Prototype

public int getNumConditionalFormattings() 

Source Link

Usage

From source file:cn.trymore.core.util.excel.PoiExcelParser.java

License:Open Source License

private Boolean isCellInConditionalFormat(HSSFSheetConditionalFormatting cfms, HSSFCell cell) {
    if ((cell != null) && (cfms != null)) {
        int rowIdx = cell.getRowIndex();
        int columnIdx = cell.getColumnIndex();
        if (cfms.getNumConditionalFormattings() > 0) {
            int i = 0;
            for (int len = cfms.getNumConditionalFormattings(); i < len; ++i) {

                if (cfms.getConditionalFormattingAt(i).getNumberOfRules() <= 0) {
                    continue;
                }/*from   www . j  a va  2s .c o m*/

                for (int k = 0; k < cfms.getConditionalFormattingAt(i).getFormattingRanges().length; ++k) {

                    if (!(cfms.getConditionalFormattingAt(i).getFormattingRanges()[k].isInRange(rowIdx,
                            columnIdx))) {
                        continue;
                    }

                    for (int j = 0, size = cfms.getConditionalFormattingAt(i)
                            .getNumberOfRules(); j < size; ++j) {
                        HSSFConditionalFormattingRule rule = cfms.getConditionalFormattingAt(i).getRule(j);
                        handleContionalFormatCell(rule, cell);
                    }
                    return Boolean.valueOf(true);
                }
            }
        }
    }
    return Boolean.valueOf(false);
}