Package org.apache.poi.hssf.usermodel

Examples of org.apache.poi.hssf.usermodel.HSSFCell


            for (int r = 0; r < Rcount; r++) {
              HSSFRow row = sheet.getRow(r);
              if (row != null) {
                int cCount = row.getPhysicalNumberOfCells();
                for (int c = 0; c < cCount; c++) {
                  HSSFCell cell = row.getCell(c);
                  if (cell != null) {
                    int celltype = cell.getCellType();
                    if (celltype == HSSFCell.CELL_TYPE_STRING) {
                      HSSFRichTextString rts = cell.getRichStringCellValue();
                      if (rts != null) {
                        contents = contents + rts.getString() + ",";
                      }
                    } else if (celltype == HSSFCell.CELL_TYPE_NUMERIC) {
                      double num = cell.getNumericCellValue();
                      contents = contents + num + ",";
                    }
                    HSSFComment comm = cell.getCellComment();
                    if (comm != null) {
                      contents = contents + comm + ",";
                    }

                  }
View Full Code Here


        font = wb.createFont();
        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

        value = new HSSFRichTextString("Name");
        value.applyFont(font);
        HSSFCell cell = row.createCell((short)0);
        cell.setCellValue(value);
        cell.setCellStyle(style);

        value = new HSSFRichTextString("Email");
        value.applyFont(font);
        cell = row.createCell((short)1);
        cell.setCellValue(value);
        cell.setCellStyle(style);

        value = new HSSFRichTextString("Age");
        value.applyFont(font);
        cell = row.createCell((short)2);
        cell.setCellValue(value);
        cell.setCellStyle(style);

        value = new HSSFRichTextString("Holdings");
        value.applyFont(font);
        cell = row.createCell((short)3);
        cell.setCellValue(value);
        cell.setCellStyle(style);

        value = new HSSFRichTextString("Investments");
        value.applyFont(font);
        cell = row.createCell((short)4);
        cell.setCellValue(value);
        cell.setCellStyle(style);

        int rowIndex = 4;

        List<Customer> customers = customerService.getCustomers();
        for (int i = 0; i < customers.size(); i++) {
View Full Code Here

            HSSFRow row = createRow(sheet);
            HSSFCellStyle style = createHeaderStyle(sheet);
            final List tableColumns = table.getExportColumnList();

            for (int i = 0, size = tableColumns.size(); i < size; i++) {
                HSSFCell cell = row.createCell(i);
                cell.setCellStyle(style);

                Column column = (Column) tableColumns.get(i);
                String title = column.getHeaderTitle();
                cell.setCellValue(title);
            }
        }
    }
View Full Code Here

            Object row = table.getRowList().get(rowIndex);

            for (int columnIndex = 0, size = tableColumns.size(); columnIndex <
                size; columnIndex++) {
                HSSFCell cell = excelRow.createCell(columnIndex);
                Column column = (Column) tableColumns.get(columnIndex);
                HSSFCellStyle style = cellStyles.get(column.getName());
                if (style != null) {
                    cell.setCellStyle(style);
                }

                Object columnValue =
                    getColumnValue(row, column, context);
View Full Code Here

      return resultText.toString();
    }
   
    HSSFSheet sheet;
    HSSFRow row;
    HSSFCell cell;
    int sNum = 0;
    int rNum = 0;
    int cNum = 0;
   
    sNum = wb.getNumberOfSheets();
   
    for (int i=0; i<sNum; i++) {
      if ((sheet = wb.getSheetAt(i)) == null) {
        continue;
      }
      rNum = sheet.getLastRowNum();
      for (int j=0; j<=rNum; j++) {
        if ((row = sheet.getRow(j)) == null){
          continue;
        }
        cNum = row.getLastCellNum();
       
        for (int k=0; k<cNum; k++) {
          if ((cell = row.getCell((short) k)) != null) {
            /*if(HSSFDateUtil.isCellDateFormatted(cell) == true) {
                resultText.append(cell.getDateCellValue().toString())
              } else
             */
            if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
              resultText.append(cell.getStringCellValue()).append(" ");
            } else if (cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) {
              double d = cell.getNumericCellValue();
              resultText.append(d).append(" ");
            }
            /* else if(cell.getCellType() == HSSFCell.CELL_TYPE_FORMULA){
                 resultText.append(cell.getCellFormula());
               }
View Full Code Here

    }
    return columns;
  }

  private static void addColumnValue(HSSFRow rowHeader, UIComponent component, int index, FacesContext context) {
    HSSFCell cell = rowHeader.createCell((short) index);
    cell.setEncoding(HSSFCell.ENCODING_UTF_16);
    if (component instanceof ValueHolder) {
      String stringValue = RenderUtils.getFormattedValue(context, component);
      cell.setCellValue(stringValue);
    } else if (component instanceof org.apache.myfaces.tobago.component.UIColumn
        || component instanceof UICommand) {
      String value = component.getAttributes().get("label") != null
          ? component.getAttributes().get("label").toString() : "";
      cell.setCellValue(value);
    }
  }
View Full Code Here

            for (int j = 1; j <= sheetLastRowNumber; j++) {
                HSSFRow row = sheet.getRow(j);
                if (row != null) {
                    // read productId from first column "sheet column index
                    // starts from 0"
                    HSSFCell cell2 = row.getCell(2);
                    cell2.setCellType(HSSFCell.CELL_TYPE_STRING);
                    String productId = cell2.getRichStringCellValue().toString();
                    // read QOH from ninth column
                    HSSFCell cell5 = row.getCell(5);
                    BigDecimal quantityOnHand = BigDecimal.ZERO;
                    if (cell5 != null && cell5.getCellType() == HSSFCell.CELL_TYPE_NUMERIC)
                        quantityOnHand = new BigDecimal(cell5.getNumericCellValue());

                    // check productId if null then skip creating inventory item
                    // too.
                    boolean productExists = ImportProductHelper.checkProductExists(productId, delegator);
View Full Code Here

    ExcelReportUtil.createXLS(report, bout);

    final HSSFWorkbook wb = new HSSFWorkbook(new ByteArrayInputStream(bout.toByteArray()));
    final HSSFSheet sheetAt = wb.getSheetAt(0);
    final HSSFRow row = sheetAt.getRow(0);
    final HSSFCell cell0 = row.getCell(0);

    // assert that we are in the correct export type ..
    final HSSFCellStyle cellStyle = cell0.getCellStyle();
    final HSSFColor fillBackgroundColorColor = cellStyle.getFillBackgroundColorColor();
    final HSSFColor fillForegroundColorColor = cellStyle.getFillForegroundColorColor();
    assertEquals("0:0:0", fillBackgroundColorColor.getHexString());
    assertEquals("FFFF:FFFF:9999", fillForegroundColorColor.getHexString());
View Full Code Here

    ExcelReportUtil.createXLS(report, bout);

    final HSSFWorkbook wb = new HSSFWorkbook(new ByteArrayInputStream(bout.toByteArray()));
    final HSSFSheet sheetAt = wb.getSheetAt(0);
    final HSSFRow row = sheetAt.getRow(0);
    final HSSFCell cell0 = row.getCell(0);
    assertEquals(Cell.CELL_TYPE_NUMERIC, cell0.getCellType());
    assertEquals("yyyy-MM-dd", cell0.getCellStyle().getDataFormatString());
    final HSSFCell cell1 = row.getCell(1);
    assertEquals(Cell.CELL_TYPE_NUMERIC, cell1.getCellType());
    assertEquals("#,###.00;(#,###.00)", cell1.getCellStyle().getDataFormatString());
  }
View Full Code Here

    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet("Search results");

    HSSFRow title = sheet.createRow(0);
    HSSFCell titleCell1 = title.createCell(0);
    titleCell1.setCellValue(this.filter);
    HSSFCell titleCell2 = title.createCell(1);
    titleCell2.setCellValue("");
    HSSFCell titleCell3 = title.createCell(2);
    titleCell3.setCellValue("");
    HSSFCell titleCell4 = title.createCell(3);
    titleCell4.setCellValue("");
    HSSFCell titleCell5 = title.createCell(4);
    titleCell5.setCellValue("");
    HSSFCell titleCell6 = title.createCell(5);
    titleCell6.setCellValue("");

    HSSFCell titleCell7 = title.createCell(6);
    titleCell7.setCellValue("");
    HSSFCell titleCell8 = title.createCell(7);
    titleCell8.setCellValue("");

    HSSFCell titleCell9 = title.createCell(8);
    titleCell9.setCellValue("");

    HSSFRow row0 = sheet.createRow(1);
    HSSFCell headercell0 = row0.createCell(0);
    headercell0.setCellValue(Helper.getTranslation("title"));
    HSSFCell headercell1 = row0.createCell(1);
    headercell1.setCellValue(Helper.getTranslation("ID"));
    HSSFCell headercell2 = row0.createCell(2);
    headercell2.setCellValue(Helper.getTranslation("Datum"));
    HSSFCell headercell3 = row0.createCell(3);
    headercell3.setCellValue(Helper.getTranslation("CountImages"));
    HSSFCell headercell4 = row0.createCell(4);
    headercell4.setCellValue(Helper.getTranslation("CountMetadata"));
    HSSFCell headercell5 = row0.createCell(5);
    headercell5.setCellValue(Helper.getTranslation("Project"));
    HSSFCell headercell6 = row0.createCell(6);
    headercell6.setCellValue(Helper.getTranslation("Status"));

    HSSFCell headercell7 = row0.createCell(7);
    headercell7.setCellValue(Helper.getTranslation("AltRefNo"));

    HSSFCell headercell8 = row0.createCell(8);
    headercell8.setCellValue(Helper.getTranslation("b-number"));

    int rowcounter = 2;
    for (Prozess p : pl) {
      HSSFRow row = sheet.createRow(rowcounter);
      HSSFCell cell0 = row.createCell(0);
      cell0.setCellValue(p.getTitel());
      HSSFCell cell1 = row.createCell(1);
      cell1.setCellValue(p.getId());
      HSSFCell cell2 = row.createCell(2);
      cell2.setCellValue(p.getErstellungsdatum().toGMTString());
      HSSFCell cell3 = row.createCell(3);
      cell3.setCellValue(p.getSortHelperImages());
      HSSFCell cell4 = row.createCell(4);
      cell4.setCellValue(p.getSortHelperDocstructs());
      HSSFCell cell5 = row.createCell(5);
      cell5.setCellValue(p.getProjekt().getTitel());

      HSSFCell cell6 = row.createCell(6);

      cell6.setCellValue(p.getSortHelperStatus().substring(0, 3) + " / " + p.getSortHelperStatus().substring(3, 6) + " / "
          + p.getSortHelperStatus().substring(6));
      HSSFCell cell7 = row.createCell(7);
      cell7.setCellValue("");
      HSSFCell cell8 = row.createCell(8);
      cell8.setCellValue("");
      if (p.getEigenschaftenList().size() > 0) {
        for (Prozesseigenschaft pe : p.getEigenschaftenList()) {
          if (pe.getTitel().equals("AltRefNo")) {
            cell7.setCellValue(pe.getWert());
          } else if (pe.getTitel().equals("b-number")) {
            cell8.setCellValue(pe.getWert());
          }
        }
      }

      rowcounter++;
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.usermodel.HSSFCell

Copyright © 2018 www.massapicom. 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.