Examples of createCellStyle()


Examples of org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle()

    // we style the second cell as a date (and time). It is important to
    // create a new cell style from the workbook
    // otherwise you can end up modifying the built in style and effecting
    // not only this cell but other cells.
    HSSFCellStyle cellStyle = wb.createCellStyle();
    DataFormat df = wb.createDataFormat();
    // cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy"));
    cellStyle.setDataFormat(df.getFormat("YYYY-MM-DD HH:MM:SS"));
    cell = row.createCell(1);
    cell.setCellValue(new Date());
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle()

        assertEquals(IndexedColors.AUTOMATIC.getIndex(), style1.getFillBackgroundColor());
        assertNull(style1.getFillBackgroundXSSFColor());

        //compatibility with HSSF
        HSSFWorkbook wb2 = new HSSFWorkbook();
        HSSFCellStyle style2 = wb2.createCellStyle();
        assertEquals(style2.getFillBackgroundColor(), style1.getFillBackgroundColor());
        assertEquals(style2.getFillForegroundColor(), style1.getFillForegroundColor());
        assertEquals(style2.getFillPattern(), style1.getFillPattern());

        assertEquals(style2.getLeftBorderColor(), style1.getLeftBorderColor());
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle()

                String columnName = model.getColumnName(columnIndex);

                HSSFCell cell = headerRow.createCell(columnIndex);
                cell.setCellValue(columnName);

                HSSFCellStyle cellStyle = workbook.createCellStyle();
                HSSFFont tableHeadingFont = workbook.createFont();
                tableHeadingFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
                cellStyle.setFont(tableHeadingFont);
                cell.setCellStyle(cellStyle);
            }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle()

                currentExcelGroupSum = new ExcelGroupSum(
                    (short) l, row
                        .createCell(groupResultColumn
                            .shortValue()),
                    groupSumColumn.shortValue(),
                    dayColorIndex, wb.createCellStyle());
              }

            }
            cell.setCellStyle(cellStyle.createDayStyle(wrapText,
                groupSumValue));
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle()

        worksheet.createRow((short)2);

        row = worksheet.createRow((short)3);

        HSSFCellStyle style = wb.createCellStyle();
        style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        font = wb.createFont();
        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

        value = new HSSFRichTextString("Name");
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle()

         intRowCount++;
      }

      // ---
      FileOutputStream fos = new FileOutputStream(fleTarget);
      HSSFCellStyle cseCellStyle = wbk.createCellStyle();
      cseCellStyle.setBorderBottom((short) 1);
      cseCellStyle.setFillBackgroundColor((short) 245);
      wbk.write(fos);

      fos.close();
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle()

      FileInputStream fileIS = new FileInputStream(new File(fileName));

      HSSFWorkbook workbook = new HSSFWorkbook(fileIS);
      HSSFSheet sheet = workbook.getSheetAt(0);
      HSSFCell resultCell = null;
      HSSFCellStyle passedStyle = workbook.createCellStyle();
      passedStyle.setFillForegroundColor(HSSFColor.LIGHT_GREEN.index);
      passedStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
      HSSFCellStyle failedStyle = workbook.createCellStyle();
      failedStyle.setFillForegroundColor(HSSFColor.RED.index);
      failedStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle()

      HSSFSheet sheet = workbook.getSheetAt(0);
      HSSFCell resultCell = null;
      HSSFCellStyle passedStyle = workbook.createCellStyle();
      passedStyle.setFillForegroundColor(HSSFColor.LIGHT_GREEN.index);
      passedStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
      HSSFCellStyle failedStyle = workbook.createCellStyle();
      failedStyle.setFillForegroundColor(HSSFColor.RED.index);
      failedStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
      HSSFCellStyle notExecStyle = workbook.createCellStyle();
      notExecStyle.setFillForegroundColor(HSSFColor.YELLOW.index);
      notExecStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle()

      passedStyle.setFillForegroundColor(HSSFColor.LIGHT_GREEN.index);
      passedStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
      HSSFCellStyle failedStyle = workbook.createCellStyle();
      failedStyle.setFillForegroundColor(HSSFColor.RED.index);
      failedStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
      HSSFCellStyle notExecStyle = workbook.createCellStyle();
      notExecStyle.setFillForegroundColor(HSSFColor.YELLOW.index);
      notExecStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
      Iterator rowIter = sheet.rowIterator();
      while (rowIter.hasNext()) {
        HSSFRow myRow = (HSSFRow) rowIter.next();
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle()

            rowCount = rowList.size();
           
           
            HSSFFont boldFont = wb.createFont();
            boldFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
            HSSFCellStyle boldStyle = wb.createCellStyle();
            boldStyle.setFont(boldFont);
            boldStyle.setWrapText(true);
           
            //Loop through excel 'Rows'
            for ( int i = 0; i < rowList.size(); i++ ) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.