Example #1
0
 CellStyle duplicateStyle(Cell cell, String key) {
   if (rowStyles.containsKey(key)) {
     return (CellStyle) rowStyles.get(key);
   }
   CellStyle newStyle =
       Util.duplicateStyle(
           cell.getRow().getSheet().getPoiWorkbook(), cell.getPoiCell().getCellStyle());
   rowStyles.put(key, newStyle);
   return newStyle;
 }
Example #2
0
 public void processCell(final Cell cell, final Map namedCells) {
   if (cell.getExpressions().size() > 0) {
     Expression expression = (Expression) cell.getExpressions().get(0);
     Property property = (Property) expression.getProperties().get(0);
     if (property != null
         && property.getBeanName() != null
         && property.getBeanName().indexOf(beanName) >= 0
         && property.getBean() instanceof Employee) {
       Employee employee = (Employee) property.getBean();
       if (employee.getPayment().doubleValue() >= 2000) {
         org.apache.poi.ss.usermodel.Cell hssfCell = cell.getPoiCell();
         CellStyle newStyle = duplicateStyle(cell, property.getPropertyNameAfterLastDot());
         newStyle.setFillForegroundColor(HSSFColor.RED.index);
         newStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
         hssfCell.setCellStyle(newStyle);
       }
     }
   }
 }