List of usage examples for org.apache.poi.ss.usermodel FillPatternType NO_FILL
FillPatternType NO_FILL
To view the source code for org.apache.poi.ss.usermodel FillPatternType NO_FILL.
Click Source Link
From source file:model.Report.java
public void colorCell(HSSFCell cell, short color) { CellStyle style = workbook.createCellStyle(); style.setFillBackgroundColor(color); style.setFillPattern(FillPatternType.NO_FILL); cell.setCellStyle(style);/*from www .j a va2s.c om*/ }
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;//from w w w. ja v a2s .c o m 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 { 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/*from w ww. j a v a 2s . c o 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 } }