org.apache.poi.ss.usermodel.SheetConditionalFormatting Java Examples

The following examples show how to use org.apache.poi.ss.usermodel.SheetConditionalFormatting. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConditionalFormattingEvaluator.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * lazy load by sheet since reading can be expensive
 * 
 * @param sheet
 * @return unmodifiable list of rules
 */
protected List<EvaluationConditionalFormatRule> getRules(Sheet sheet) {
    final String sheetName = sheet.getSheetName();
    List<EvaluationConditionalFormatRule> rules = formats.get(sheetName);
    if (rules == null) {
        if (formats.containsKey(sheetName)) {
            return Collections.emptyList();
        }
        final SheetConditionalFormatting scf = sheet.getSheetConditionalFormatting();
        final int count = scf.getNumConditionalFormattings();
        rules = new ArrayList<EvaluationConditionalFormatRule>(count);
        formats.put(sheetName, rules);
        for (int i=0; i < count; i++) {
            ConditionalFormatting f = scf.getConditionalFormattingAt(i);
            //optimization, as this may be expensive for lots of ranges
            final CellRangeAddress[] regions = f.getFormattingRanges();
            for (int r=0; r < f.getNumberOfRules(); r++) {
                ConditionalFormattingRule rule = f.getRule(r);
                rules.add(new EvaluationConditionalFormatRule(workbookEvaluator, sheet, f, i, rule, r, regions));
            }
        }
        // need them in formatting and priority order so logic works right
        Collections.sort(rules);
    }
    return Collections.unmodifiableList(rules);
}
 
Example #2
Source File: StreamingSheet.java    From data-prep with Apache License 2.0 4 votes vote down vote up
/**
 * Not supported
 */
@Override
public SheetConditionalFormatting getSheetConditionalFormatting() {
    throw new UnsupportedOperationException();
}
 
Example #3
Source File: FilteredSheet.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public SheetConditionalFormatting getSheetConditionalFormatting() {
	return sheet.getSheetConditionalFormatting();
}
 
Example #4
Source File: StreamingSheet.java    From excel-streaming-reader with Apache License 2.0 4 votes vote down vote up
/**
 * Not supported
 */
@Override
public SheetConditionalFormatting getSheetConditionalFormatting() {
  throw new UnsupportedOperationException();
}