Package org.apache.poi.ss.usermodel

Examples of org.apache.poi.ss.usermodel.Row$MissingCellPolicy


    return true;
  }

  private Cell getCellAt(final short x, final int y)
  {
    final Row row = getRowAt(y);
    final Cell cell = row.getCell(x);
    if (cell != null)
    {
      return cell;
    }
    return row.createCell(x);
  }
View Full Code Here


    return row.createCell(x);
  }

  private Row getRowAt(final int y)
  {
    final Row row = sheet.getRow(y);
    if (row != null)
    {
      return row;
    }
    return sheet.createRow(y);
View Full Code Here

    final int startRow = contentProducer.getFinishedRows();
    final int finishRow = contentProducer.getFilledRows();

    for (int row = startRow; row < finishRow; row++)
    {
      final Row hssfRow = getRowAt(row);
      final double lastRowHeight = StrictGeomUtility.toExternalValue(sheetLayout.getRowHeight(row));
      hssfRow.setHeightInPoints((float) (lastRowHeight));

      for (short col = 0; col < colCount; col++)
      {
        final RenderBox content = contentProducer.getContent(row, col);
        if (content == null)
View Full Code Here

      extractHeaderFooter(buffy, sheet.getOddHeader());
      extractHeaderFooter(buffy, sheet.getEvenHeader());

      // Rows and cells
      for (Object rawR : sheet) {
        Row row = (Row) rawR;
        for (Iterator<Cell> ri = row.cellIterator(); ri.hasNext();) {
          Cell cell = ri.next();

          if (cell.getCellType() == Cell.CELL_TYPE_FORMULA || cell.getCellType() == Cell.CELL_TYPE_STRING) {
            buffy.append(cell.getRichStringCellValue().getString()).append(' ');
          } else {
View Full Code Here

     for integers
     */
    public void test47490() throws Exception {
       XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("GeneralFormatTests.xlsx");
       Sheet s = wb.getSheetAt(1);
       Row r;
       DataFormatter df = new DataFormatter();
      
       r = s.getRow(1);
       assertEquals(1.0, r.getCell(2).getNumericCellValue());
       assertEquals("General", r.getCell(2).getCellStyle().getDataFormatString());
       assertEquals("1", df.formatCellValue(r.getCell(2)));
       assertEquals("1", df.formatRawCellContents(1.0, -1, "@"));
       assertEquals("1", df.formatRawCellContents(1.0, -1, "General"));
             
       r = s.getRow(2);
       assertEquals(12.0, r.getCell(2).getNumericCellValue());
       assertEquals("General", r.getCell(2).getCellStyle().getDataFormatString());
       assertEquals("12", df.formatCellValue(r.getCell(2)));
       assertEquals("12", df.formatRawCellContents(12.0, -1, "@"));
       assertEquals("12", df.formatRawCellContents(12.0, -1, "General"));
      
       r = s.getRow(3);
       assertEquals(123.0, r.getCell(2).getNumericCellValue());
       assertEquals("General", r.getCell(2).getCellStyle().getDataFormatString());
       assertEquals("123", df.formatCellValue(r.getCell(2)));
       assertEquals("123", df.formatRawCellContents(123.0, -1, "@"));
       assertEquals("123", df.formatRawCellContents(123.0, -1, "General"));
    }
View Full Code Here

             new HSSFWorkbook(),
             new XSSFWorkbook()
       };
       for(Workbook wb : wbs) {
          Sheet s = wb.createSheet();
          Row r = s.createRow(0);
         
          // Setup
          Cell cn = r.createCell(0, Cell.CELL_TYPE_NUMERIC);
          cn.setCellValue(1.2);
          Cell cs = r.createCell(1, Cell.CELL_TYPE_STRING);
          cs.setCellValue("Testing");
         
          Cell cfn = r.createCell(2, Cell.CELL_TYPE_FORMULA);
          cfn.setCellFormula("A1")
          Cell cfs = r.createCell(3, Cell.CELL_TYPE_FORMULA);
          cfs.setCellFormula("B1");
         
          FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
          assertEquals(Cell.CELL_TYPE_NUMERIC, fe.evaluate(cfn).getCellType());
          assertEquals(Cell.CELL_TYPE_STRING, fe.evaluate(cfs).getCellType());
View Full Code Here

       for(Workbook wb : wbs) {
          Sheet s = wb.createSheet();
         
          // 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
View Full Code Here

  public void processExport(OutputStream output) {

    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
View Full Code Here

  public void processExport(OutputStream output) {

    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
View Full Code Here

        }
        if (model == null) {
            throw new IllegalArgumentException("model must not be null"); //$NON-NLS-1$
        }
        Sheet sheet = info.workbook.createSheet(name);
        Row titleRow = sheet.createRow(0);
        Row valueRow = sheet.createRow(1);
        int index = 0;
        for (PropertyDeclaration property : model.getDeclaredProperties()) {
            if (index >= info.version.getMaxColumns()) {
                LOG.warn(MessageFormat.format(
                        "データシートに追加できるプロパティ数は{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:
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.usermodel.Row$MissingCellPolicy

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.