Package org.apache.poi.hssf.record

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


     * remove the HSSFCell from this row.
     * @param cell to remove
     */
    public void removeCell(HSSFCell cell)
    {
        CellValueRecordInterface cval = cell.getCellValueRecord();

        sheet.removeValueRecord(getRowNum(), cval);
        short column=cell.getCellNum();
        if(cell!=null && column<cells.length)
        {
View Full Code Here


        }

        cells[column]=null;

        if(alsoRemoveRecords) {
            CellValueRecordInterface cval = cell.getCellValueRecord();
            sheet.getSheet().removeValueRecord(getRowNum(), cval);
        }
        if (cell.getColumnIndex()+1 == row.getLastCol()) {
            row.setLastCol(calculateNewLastCellPlusOne(row.getLastCol()));
        }
View Full Code Here

            if (currentSheet == null) {
                // Ignore cells outside sheets
            } else if (cell == null) {
                // Ignore empty cells
            } else if (record instanceof CellValueRecordInterface) {
                CellValueRecordInterface value =
                    (CellValueRecordInterface) record;
                Point point = new Point(value.getColumn(), value.getRow());
                currentSheet.put(point, cell);
            }
        }
View Full Code Here

            throw new RuntimeException("Specified cell is not from this row");
        }
        cells[column]=null;
       
        if(alsoRemoveRecords) {
            CellValueRecordInterface cval = cell.getCellValueRecord();
            sheet.removeValueRecord(getRowNum(), cval);
        }
       
        if (cell.getCellNum()+1 == row.getLastCol()) {
            row.setLastCol((short) (findLastCell(row.getLastCol())+1));
View Full Code Here

            createRowFromRecord(row);

            row = sheet.getNextRow();
        }
        sheet.setLoc(sloc);
        CellValueRecordInterface cval = sheet.getNextValueRecord();
        long timestart = System.currentTimeMillis();

        if (log.check( POILogger.DEBUG ))
            log.log(DEBUG, "Time at start of cell creating in HSSF sheet = ",
                new Long(timestart));
        HSSFRow lastrow = null;

        while (cval != null)
        {
            long cellstart = System.currentTimeMillis();
            HSSFRow hrow = lastrow;

            if ( ( lastrow == null ) || ( lastrow.getRowNum() != cval.getRow() ) )
            {
                hrow = getRow( cval.getRow() );
                if (hrow == null) {
                    // Some tools (like Perl module Spreadsheet::WriteExcel - bug 41187) skip the RowRecords
                    // Excel, OpenOffice.org and GoogleDocs are all OK with this, so POI should be too.
                    if (rowRecordsAlreadyPresent) {
                        // if at least one row record is present, all should be present.
                        throw new RuntimeException("Unexpected missing row when some rows already present");
                    }
                    // create the row record on the fly now.
                    RowRecord rowRec = new RowRecord(cval.getRow());
                    sheet.addRow(rowRec);
                    hrow = createRowFromRecord(rowRec);
                }
            }
            if ( hrow != null )
View Full Code Here

            // Copy each cell from the source row to
            //  the destination row
            for(Iterator cells = row.cellIterator(); cells.hasNext(); ) {
              cell = (HSSFCell)cells.next();
                row.removeCell( cell );
                CellValueRecordInterface cellRecord = cell.getCellValueRecord();
                cellRecord.setRow( rowNum + n );
                row2Replace.createCellFromRecord( cellRecord );
                sheet.addValueRecord( rowNum + n, cellRecord );
            }
            // Now zap all the cells in the source row
            row.removeAllCells();
View Full Code Here

  public void testTurnToString() throws Exception {
    processFile("45365.xls");
   
    for(int i=0; i<mockListen._records.size(); i++) {
      Record r = (Record)mockListen._records.get(i);
      CellValueRecordInterface cvr = null;
     
      if(r instanceof NumberRecord) {
        cvr = (CellValueRecordInterface)r;
      }
      if(r instanceof FormulaRecord) {
View Full Code Here

  private FormulaExtractor() {
    // no instances of this class
  }
 
  public static Ptg[] getPtgs(HSSFCell cell) {
    CellValueRecordInterface vr = cell.getCellValueRecord();
    if (!(vr instanceof FormulaRecordAggregate)) {
      throw new IllegalArgumentException("Not a formula cell");
    }
    FormulaRecordAggregate fra = (FormulaRecordAggregate) vr;
    List tokens = fra.getFormulaRecord().getParsedExpression();
View Full Code Here

      assertEquals("90210", nc3.getRichStringCellValue().getString());
     
      // Now check record level stuff too
      ns.getSheet().setLoc(0);
      int fn = 0;
      CellValueRecordInterface cvr;
      while((cvr = ns.getSheet().getNextValueRecord()) != null) {
        if(cvr instanceof FormulaRecordAggregate) {
          FormulaRecordAggregate fr = (FormulaRecordAggregate)cvr;
         
          if(fn == 0) {
View Full Code Here

            if (cell == null) {
                // Ignore empty cells
            } else if (currentSheet != null
                    && record instanceof CellValueRecordInterface) {
                // Normal cell inside a worksheet
                CellValueRecordInterface value =
                    (CellValueRecordInterface) record;
                Point point = new Point(value.getColumn(), value.getRow());
                currentSheet.put(point, cell);
            } else {
                // Cell outside the worksheets
                extraTextCells.add(cell);
            }
View Full Code Here

TOP

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

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.