Logo Search packages:      
Sourcecode: jexcelapi version File versions  Download package

void jxl::write::biff::WritableSheetImpl::addCell ( WritableCell  cell  )  throws WriteException, RowsExceededException [inline]

Adds the cell to this sheet. If the cell has already been added to this sheet or another sheet, a WriteException is thrown. If the position to be occupied by this cell is already taken, the incumbent cell is replaced. The cell is then marked as referenced, and its formatting information registered with the list of formatting records updated if necessary The RowsExceededException may be caught if client code wishes to explicitly trap the case where too many rows have been written to the current sheet. If this behaviour is not desired, it is sufficient simply to handle the WriteException, since this is a base class of RowsExceededException

cell the cell to add

Implements jxl::write::WritableSheet.

Definition at line 1125 of file WritableSheetImpl.java.

References jxl::write::biff::RowRecord::addCell(), formatRecords, jxl::write::biff::RowRecord::getMaxColumn(), getRowRecord(), jxl::write::biff::CellValue::isReferenced(), numColumns, numRows, jxl::write::biff::CellValue::setCellDetails(), and sharedStrings.

Referenced by addHyperlink(), jxl::write::biff::SheetWriter::checkMergedBorders(), jxl::write::biff::WritableSheetCopier::deepCopyCells(), jxl::write::biff::SheetCopier::deepCopyCells(), mergeCells(), jxl::write::biff::WritableSheetCopier::shallowCopyCells(), and jxl::write::biff::SheetCopier::shallowCopyCells().

    if (cell.getType() == CellType.EMPTY)
      if (cell != null && cell.getCellFormat() == null)
        // return if it's a blank cell with no particular cell formatting
        // information
    CellValue cv = (CellValue) cell;

    if (cv.isReferenced())
      throw new JxlWriteException(JxlWriteException.cellReferenced);

    int row = cell.getRow();
    RowRecord rowrec = getRowRecord(row);

    // Adjust the max rows and max columns accordingly
    numRows = Math.max(row+1, numRows);
    numColumns = Math.max(numColumns, rowrec.getMaxColumn());

    // Indicate this cell is now part of a worksheet, so that it can't be
    // added anywhere else
    cv.setCellDetails(formatRecords, sharedStrings, this);

Generated by  Doxygen 1.6.0   Back to index