List of usage examples for org.apache.poi.xssf.usermodel XSSFCellStyle getFillBackgroundColorColor
@Override
public XSSFColor getFillBackgroundColorColor()
From source file:com.vaadin.addon.spreadsheet.XSSFColorConverter.java
License:Open Source License
@Override public void defaultColorStyles(CellStyle cellStyle, StringBuilder sb) { XSSFCellStyle cs = (XSSFCellStyle) cellStyle; XSSFColor fillForegroundColorColor = cs.getFillForegroundColorColor(); XSSFColor fillBackgroundColorColor = cs.getFillBackgroundColorColor(); defaultBackgroundColor = styleColor(fillForegroundColorColor); defaultBackgroundColor = styleColor(fillBackgroundColorColor); if (defaultBackgroundColor == null) { defaultBackgroundColor = "rgba(255,255,255,1.0);"; }/* w w w. ja v a2 s.c om*/ sb.append("background-color:"); sb.append(defaultBackgroundColor); XSSFColor xssfColor = cs.getFont().getXSSFColor(); defaultColor = styleColor(xssfColor); if (defaultColor == null) { defaultColor = "rgba(0,0,0,1.0);"; } sb.append("color:"); sb.append(defaultColor); }
From source file:Sheets.GlobalSheet.java
@Override protected void createDateRows() throws SQLException { int currentColN = 11; Row row1 = sheet.getRow(21); //row com os "X" dos dias letivos Row row2 = sheet.getRow(23); //row com os dias da semana Row row3 = sheet.getRow(24); //row com as datas XSSFCellStyle style; for (CustomDate cDate : dates) { XSSFCell cell1 = (XSSFCell) row1.getCell(currentColN); XSSFCell cell2 = (XSSFCell) row2.getCell(currentColN); XSSFCell cell3 = (XSSFCell) row3.getCell(currentColN); boolean classRegistered = false; for (StudentClassDiscipline studentClassDiscipline : studentClassDisciplines) { ArrayList<Class> classes = ClassDAO .getClassesByStudentClassDisciplineAndDate(studentClassDiscipline, cDate.getDate()); if (!classes.isEmpty()) //se pelo menos uma aula ocorreu {/*from w w w . java 2 s.c om*/ classRegistered = true; studentClassDiscipline.getWeekDays().addDate(cDate); //essa turma/disciplina tem aula no dia da semana de cDate for (Class classs : classes) { this.totalHours += classs.getHoursPerDay(); } } } if (classRegistered) { this.nClassDays++; cell1.setCellValue("X"); } cell2.setCellValue(" " + cDate.getWeekDay()); cell3.setCellValue(new java.util.Date(cDate.getDate().getTime())); style = (XSSFCellStyle) cell1.getCellStyle().clone(); XSSFColor fillBackgroundColorColor = style.getFillBackgroundColorColor(); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setFillForegroundColor(fillBackgroundColorColor); cell1.setCellStyle(style); style = (XSSFCellStyle) cell2.getCellStyle().clone(); style.setFillPattern(FillPatternType.NO_FILL); cell2.setCellStyle(style); style = (XSSFCellStyle) cell3.getCellStyle().clone(); style.setFillPattern(FillPatternType.NO_FILL); cell3.setCellStyle(style); currentColN++;//vai pra prxima coluna } }
From source file:Sheets.PartialSheet.java
/** * Cria as linhas das datas/*w w w .j a v a2 s . co m*/ * @throws java.sql.SQLException */ @Override protected void createDateRows() throws SQLException { int currentColN = 11; Row row1 = sheet.getRow(10); //row com os "X" dos dias letivos Row row2 = sheet.getRow(12); //row com os dias da semana Row row3 = sheet.getRow(13); //row com as datas XSSFCellStyle style; for (CustomDate cDate : dates) { ArrayList<Class> classes = ClassDAO.getClassesByStudentClassDisciplineAndDate(studentClassDiscipline, cDate.getDate()); XSSFCell cell1 = (XSSFCell) row1.getCell(currentColN); XSSFCell cell2 = (XSSFCell) row2.getCell(currentColN); XSSFCell cell3 = (XSSFCell) row3.getCell(currentColN); if (!classes.isEmpty()) { Class classs = classes.get(0);//pega somente a primeira aula (no deveria existir mais de uma aula de uma displiplina em um mesmo dia) this.totalHours += classs.getHoursPerDay(); this.nClassDays++; cell1.setCellValue("X"); } cell2.setCellValue(" " + cDate.getWeekDay()); cell3.setCellValue(new java.util.Date(cDate.getDate().getTime())); style = (XSSFCellStyle) cell1.getCellStyle().clone(); XSSFColor fillBackgroundColorColor = style.getFillBackgroundColorColor(); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setFillForegroundColor(fillBackgroundColorColor); cell1.setCellStyle(style); style = (XSSFCellStyle) cell2.getCellStyle().clone(); style.setFillPattern(FillPatternType.NO_FILL); cell2.setCellStyle(style); style = (XSSFCellStyle) cell3.getCellStyle().clone(); style.setFillPattern(FillPatternType.NO_FILL); cell3.setCellStyle(style); currentColN++;//vai pra prxima coluna } }