Package org.apache.poi.hssf.record

Examples of org.apache.poi.hssf.record.RowRecord


        if (row.getRowNumber() < d.getFirstRow()) {
            d.setFirstRow(row.getRowNumber());
        }

        //If the row exists remove it, so that any cells attached to the row are removed
        RowRecord existingRow = _rowsAggregate.getRow(row.getRowNumber());
        if (existingRow != null) {
            _rowsAggregate.removeRow(existingRow);
        }

        _rowsAggregate.insertRow(row);
View Full Code Here


    public void groupRowRange(int fromRow, int toRow, boolean indent)
    {
        for (int rowNum = fromRow; rowNum <= toRow; rowNum++)
        {
            RowRecord row = getRow( rowNum );
            if (row == null)
            {
                row = RowRecordsAggregate.createRow(rowNum);
                addRow( row );
            }
            int level = row.getOutlineLevel();
            if (indent) level++; else level--;
            level = Math.max(0, level);
            level = Math.min(7, level);
            row.setOutlineLevel((short) ( level ));
        }

        recalcRowGutter();
    }
View Full Code Here

    private void recalcRowGutter() {
        int maxLevel = 0;
        Iterator iterator = _rowsAggregate.getIterator();
        while (iterator.hasNext()) {
            RowRecord rowRecord = (RowRecord) iterator.next();
            maxLevel = Math.max(rowRecord.getOutlineLevel(), maxLevel);
        }

        // Grab the guts record, adding if needed
        GutsRecord guts = getGutsRecord();
        // Set the levels onto it
View Full Code Here

   
    // We have rows 0, 1, 2, 20 and 21
    int row0 = -1;
    for(int i=0; i<r.length; i++) {
      if(r[i] instanceof RowRecord) {
        RowRecord rr = (RowRecord)r[i];
        if(rr.getRowNumber() == 0) { row0 = i; }
      }
    }
    assertTrue(row0 > -1);
   
    // Following row 0, we should have 1, 2, then dummy, then 20+21+22
    assertTrue(r[row0] instanceof RowRecord);
    assertTrue(r[row0+1] instanceof RowRecord);
    assertTrue(r[row0+2] instanceof RowRecord);
    assertTrue(r[row0+3] instanceof MissingRowDummyRecord);
    assertTrue(r[row0+4] instanceof MissingRowDummyRecord);
    assertTrue(r[row0+5] instanceof MissingRowDummyRecord);
    assertTrue(r[row0+6] instanceof MissingRowDummyRecord);
    // ...
    assertTrue(r[row0+18] instanceof MissingRowDummyRecord);
    assertTrue(r[row0+19] instanceof MissingRowDummyRecord);
    assertTrue(r[row0+20] instanceof RowRecord);
    assertTrue(r[row0+21] instanceof RowRecord);
    assertTrue(r[row0+22] instanceof RowRecord);
   
    // Check things had the right row numbers
    RowRecord rr;
    rr = (RowRecord)r[row0+2];
    assertEquals(2, rr.getRowNumber());
    rr = (RowRecord)r[row0+20];
    assertEquals(20, rr.getRowNumber());
    rr = (RowRecord)r[row0+21];
    assertEquals(21, rr.getRowNumber());
   
    MissingRowDummyRecord mr;
    mr = (MissingRowDummyRecord)r[row0+3];
    assertEquals(3, mr.getRowNumber());
    mr = (MissingRowDummyRecord)r[row0+4];
View Full Code Here

        if(r.getType() == BOFRecord.TYPE_WORKSHEET) {
          log("On new sheet");
        }
      }
      if(record instanceof RowRecord) {
        RowRecord rr = (RowRecord)record;
        log("Starting row #" + rr.getRowNumber());
      }
    }
View Full Code Here

            // Reset the row and column counts - new workbook / worksheet
            resetCounts();
          }
          break;
        case RowRecord.sid:
          RowRecord rowrec = (RowRecord) record;
          //System.out.println("Row " + rowrec.getRowNumber() + " found, first column at "
          //        + rowrec.getFirstCol() + " last column at " + rowrec.getLastCol());

          // If there's a jump in rows, fire off missing row records
          if (lastRowRow + 1 < rowrec.getRowNumber()) {
            for (int i = (lastRowRow + 1); i < rowrec.getRowNumber(); i++) {
              MissingRowDummyRecord dr = new MissingRowDummyRecord(i);
              childListener.processRecord(dr);
            }
          }

          // Record this as the last row we saw
          lastRowRow = rowrec.getRowNumber();
          lastCellColumn = -1;
          break;

        case SharedFormulaRecord.sid:
          // SharedFormulaRecord occurs after the first FormulaRecord of the cell range.
View Full Code Here

  public void removeRow(RowRecord row) {
    int rowIndex = row.getRowNumber();
    _valuesAgg.removeAllCellsValuesForRow(rowIndex);
    Integer key = Integer.valueOf(rowIndex);
    RowRecord rr = _rowRecords.remove(key);
    if (rr == null) {
      throw new RuntimeException("Invalid row index (" + key.intValue() + ")");
    }
    if (row != rr) {
      _rowRecords.put(key, rr);
View Full Code Here

    return _rowRecords.values().iterator();
  }

  public int findStartOfRowOutlineGroup(int row) {
    // Find the start of the group.
    RowRecord rowRecord = this.getRow( row );
    int level = rowRecord.getOutlineLevel();
    int currentRow = row;
    while (this.getRow( currentRow ) != null) {
      rowRecord = this.getRow( currentRow );
      if (rowRecord.getOutlineLevel() < level) {
        return currentRow + 1;
      }
      currentRow--;
    }
View Full Code Here

   * Hide all rows at or below the current outline level
   * @return index of the <em>next<em> row after the last row that gets hidden
   */
  private int writeHidden(RowRecord pRowRecord, int row) {
    int rowIx = row;
    RowRecord rowRecord = pRowRecord;
    int level = rowRecord.getOutlineLevel();
    while (rowRecord != null && getRow(rowIx).getOutlineLevel() >= level) {
      rowRecord.setZeroHeight(true);
      rowIx++;
      rowRecord = getRow(rowIx);
    }
    return rowIx;
  }
View Full Code Here

  public void collapseRow(int rowNumber) {

    // Find the start of the group.
    int startRow = findStartOfRowOutlineGroup(rowNumber);
    RowRecord rowRecord = getRow(startRow);

    // Hide all the columns until the end of the group
    int nextRowIx = writeHidden(rowRecord, startRow);

    RowRecord row = getRow(nextRowIx);
    if (row == null) {
      row = createRow(nextRowIx);
      insertRow(row);
    }
    // Write collapse field
    row.setColapsed(true);
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.RowRecord

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.