Package org.apache.poi.ss.usermodel

Examples of org.apache.poi.ss.usermodel.Cell


         
          // Populate
          for(int rn=0; rn<= topRow; rn++) {
             Row r = s.createRow(rn);
             for(int cn=0; cn<leftmostColumn; cn++) {
                Cell c = r.createCell(cn, Cell.CELL_TYPE_NUMERIC);
                c.setCellValue(100*rn + cn);
             }
          }
         
          // Create the Freeze Pane
          s.createFreezePane(colSplit, rowSplit, leftmostColumn, topRow);
View Full Code Here


    try {
      HSSFWorkbook workbook = new HSSFWorkbook();
      HSSFSheet sheet = workbook.createSheet(exportConf.getFileName());
      Row row = null;
      Cell cell = null;
      int rowIndex = 0;
      int columnIndex;

      // Header
      if (exportConf.getIncludeHeader()) {

        for (HtmlRow htmlRow : table.getHeadRows()) {

          row = sheet.createRow(rowIndex++);
          columnIndex = 0;

          for (HtmlColumn column : htmlRow.getColumns(ReservedFormat.ALL, ReservedFormat.XLS)) {
            cell = row.createCell(columnIndex++);
            cell.setCellValue(column.getContent().toString());
          }
        }
      }

      // Body
      for (HtmlRow htmlRow : table.getBodyRows()) {

        row = sheet.createRow(rowIndex++);
        columnIndex = 0;

        for (HtmlColumn column : htmlRow.getColumns(ReservedFormat.ALL, ReservedFormat.XLS)) {
          cell = row.createCell(columnIndex++);
          cell.setCellValue(column.getContent().toString());
        }
      }

      // Column auto-sizing
      for (columnIndex = 0; columnIndex < table.getLastHeaderRow().getColumns(ReservedFormat.ALL, ReservedFormat.XLS).size(); columnIndex++) {
View Full Code Here

    try {
      XSSFWorkbook workbook = new XSSFWorkbook();
      XSSFSheet sheet = workbook.createSheet(exportConf.getFileName());
      Row row = null;
      Cell cell = null;
      int rowIndex = 0;
      int columnIndex;

      // Header
      if (exportConf.getIncludeHeader()) {

        for (HtmlRow htmlRow : table.getHeadRows()) {

          row = sheet.createRow(rowIndex++);
          columnIndex = 0;

          for (HtmlColumn column : htmlRow.getColumns(ReservedFormat.ALL, ReservedFormat.XLSX)) {
            cell = row.createCell(columnIndex++);
            cell.setCellValue(column.getContent().toString());
          }
        }
      }

      // Body
      for (HtmlRow htmlRow : table.getBodyRows()) {

        row = sheet.createRow(rowIndex++);
        columnIndex = 0;

        for (HtmlColumn column : htmlRow.getColumns(ReservedFormat.ALL, ReservedFormat.XLSX)) {
          cell = row.createCell(columnIndex++);
          cell.setCellValue(column.getContent().toString());
        }
      }

      // Column auto-sizing
      for (columnIndex = 0; columnIndex < table.getLastHeaderRow().getColumns(ReservedFormat.ALL, ReservedFormat.XLSX).size(); columnIndex++) {
View Full Code Here

                        "データシートに追加できるプロパティ数は{0}までです: {1}",
                        info.version.getMaxColumns(),
                        model.getName()));
                break;
            }
            Cell title = titleRow.createCell(index);
            title.setCellStyle(info.titleStyle);
            title.setCellValue(property.getName().identifier);

            Cell value = valueRow.createCell(index);
            value.setCellStyle(info.dataStyle);
            if (property.getType() instanceof BasicType) {
                BasicType type = (BasicType) property.getType();
                switch (type.getKind()) {
                case DATE:
                    value.setCellStyle(info.dateDataStyle);
                    break;
                case DATETIME:
                    value.setCellStyle(info.datetimeDataStyle);
                    break;
                default:
                    break;
                }
            }
View Full Code Here

        }
    }

    private void fillRuleFormat(Sheet sheet) {
        assert sheet != null;
        Cell value = getCell(sheet, RuleSheetFormat.FORMAT, 0, 1);
        value.setCellStyle(info.lockedStyle);
        value.setCellValue(RuleSheetFormat.FORMAT_VERSION);
    }
View Full Code Here

        value.setCellValue(RuleSheetFormat.FORMAT_VERSION);
    }

    private void fillRuleTotalCondition(Sheet sheet) {
        assert sheet != null;
        Cell value = getCell(sheet, RuleSheetFormat.TOTAL_CONDITION, 0, 1);
        value.setCellStyle(info.optionsStyle);
        String[] options = TotalConditionKind.getOptions();
        value.setCellValue(options[0]);
        setExplicitListConstraint(sheet, options,
                value.getRowIndex(), value.getColumnIndex(),
                value.getRowIndex(), value.getColumnIndex());
    }
View Full Code Here

    }

    private void setTitle(Sheet sheet, RuleSheetFormat item) {
        assert sheet != null;
        assert item != null;
        Cell cell = getCell(sheet, item.getRowIndex(), item.getColumnIndex());
        cell.setCellStyle(info.titleStyle);
        cell.setCellValue(item.getTitle());
    }
View Full Code Here

    }

    private void fillRulePropertyConditions(Sheet sheet, ModelDeclaration model) {
        int index = 1;
        for (PropertyDeclaration property : model.getDeclaredProperties()) {
            Cell name = getCell(sheet, RuleSheetFormat.PROPERTY_NAME, index, 0);
            name.setCellStyle(info.lockedStyle);
            name.setCellValue(property.getName().identifier);

            Cell value = getCell(sheet, RuleSheetFormat.VALUE_CONDITION, index, 0);
            value.setCellStyle(info.optionsStyle);
            if (index == 1) {
                value.setCellValue(ValueConditionKind.KEY.getText());
            } else {
                value.setCellValue(ValueConditionKind.ANY.getText());
            }

            Cell nullity = getCell(sheet, RuleSheetFormat.NULLITY_CONDITION, index, 0);
            nullity.setCellStyle(info.optionsStyle);
            nullity.setCellValue(NullityConditionKind.NORMAL.getText());

            Cell comments = getCell(sheet, RuleSheetFormat.COMMENTS, index, 0);
            comments.setCellStyle(info.dataStyle);
            comments.setCellValue(property.getDescription() == null
                    ? property.getType().toString() : property.getDescription().getText());

            Cell options = getCell(sheet, RuleSheetFormat.EXTRA_OPTIONS, index, 0);
            options.setCellStyle(info.dataStyle);

            index++;
        }

        int start = RuleSheetFormat.PROPERTY_NAME.getRowIndex() + 1;
View Full Code Here

        assert sheet != null;
        Row row = sheet.getRow(rowIndex);
        if (row == null) {
            row = sheet.createRow(rowIndex);
        }
        Cell cell = row.getCell(columnIndex, Row.CREATE_NULL_AS_BLANK);
        return cell;
    }
View Full Code Here

     * @return cell string
     */
    protected String cell(Sheet sheet, int rowIndex, int columnIndex) {
        Row row = sheet.getRow(rowIndex);
        assertThat(row, not(nullValue()));
        Cell cell = row.getCell(columnIndex);
        if (cell == null || cell.getCellType() == Cell.CELL_TYPE_BLANK) {
            return null;
        }
        assertThat(cell.getCellType(), is(Cell.CELL_TYPE_STRING));
        return cell.getStringCellValue();
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.usermodel.Cell

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.