public final static short ENCODING_UTF_16 = 1;
private final HSSFWorkbook book;
- private final Sheet sheet;
+ private final HSSFSheet sheet;
private int cellType;
private HSSFRichTextString stringValue;
private CellValueRecordInterface record;
*
* @see org.apache.poi.hssf.usermodel.HSSFRow#createCell(short)
*/
- protected HSSFCell(HSSFWorkbook book, Sheet sheet, int row, short col)
+ protected HSSFCell(HSSFWorkbook book, HSSFSheet sheet, int row, short col)
{
checkBounds(col);
stringValue = null;
// Relying on the fact that by default the cellType is set to 0 which
// is different to CELL_TYPE_BLANK hence the following method call correctly
// creates a new blank cell.
- short xfindex = sheet.getXFIndexForColAt(col);
+ short xfindex = sheet.getSheet().getXFIndexForColAt(col);
setCellType(CELL_TYPE_BLANK, false, row, col,xfindex);
}
- /* package */ Sheet getSheet() {
+ /* package */ HSSFSheet getSheet() {
return sheet;
}
* Type of cell
* @see org.apache.poi.hssf.usermodel.HSSFRow#createCell(short,int)
*/
- protected HSSFCell(HSSFWorkbook book, Sheet sheet, int row, short col,
+ protected HSSFCell(HSSFWorkbook book, HSSFSheet sheet, int row, short col,
int type)
{
checkBounds(col);
this.book = book;
this.sheet = sheet;
- short xfindex = sheet.getXFIndexForColAt(col);
+ short xfindex = sheet.getSheet().getXFIndexForColAt(col);
setCellType(type,false,row,col,xfindex);
}
* @param sheet - Sheet record of the sheet containing this cell
* @param cval - the Cell Value Record we wish to represent
*/
- protected HSSFCell(HSSFWorkbook book, Sheet sheet, CellValueRecordInterface cval) {
+ protected HSSFCell(HSSFWorkbook book, HSSFSheet sheet, CellValueRecordInterface cval) {
record = cval;
cellType = determineType(cval);
stringValue = null;
FormulaRecordAggregate frec;
if (cellType != this.cellType) {
- frec = sheet.createFormula(row, col);
+ frec = sheet.getSheet().createFormula(row, col);
} else {
frec = (FormulaRecordAggregate) record;
frec.setRow(row);
if (cellType != this.cellType &&
this.cellType!=-1 ) // Special Value to indicate an uninitialized Cell
{
- sheet.replaceValueRecord(record);
+ sheet.getSheet().replaceValueRecord(record);
}
this.cellType = cellType;
}
{
int row=record.getRow();
short col=record.getColumn();
- this.sheet.setActiveCellRow(row);
- this.sheet.setActiveCellCol(col);
+ this.sheet.getSheet().setActiveCellRow(row);
+ this.sheet.getSheet().setActiveCellCol(col);
}
/**
*/
public HSSFComment getCellComment(){
if (comment == null) {
- comment = findCellComment(sheet, record.getRow(), record.getColumn());
+ comment = findCellComment(sheet.getSheet(), record.getRow(), record.getColumn());
}
return comment;
}
* all comments after performing this action!
*/
public void removeCellComment() {
- HSSFComment comment = findCellComment(sheet, record.getRow(), record.getColumn());
+ HSSFComment comment = findCellComment(sheet.getSheet(), record.getRow(), record.getColumn());
this.comment = null;
if(comment == null) {
}
// Zap the underlying NoteRecord
- List sheetRecords = sheet.getRecords();
+ List sheetRecords = sheet.getSheet().getRecords();
sheetRecords.remove(comment.getNoteRecord());
// If we have a TextObjectRecord, is should
* @return hyperlink associated with this cell or null if not found
*/
public HSSFHyperlink getHyperlink(){
- for (Iterator it = sheet.getRecords().iterator(); it.hasNext(); ) {
+ for (Iterator it = sheet.getSheet().getRecords().iterator(); it.hasNext(); ) {
RecordBase rec = (RecordBase) it.next();
if (rec instanceof HyperlinkRecord){
HyperlinkRecord link = (HyperlinkRecord)rec;
break;
}
- int eofLoc = sheet.findFirstRecordLocBySid( EOFRecord.sid );
- sheet.getRecords().add( eofLoc, link.record );
+ int eofLoc = sheet.getSheet().findFirstRecordLocBySid( EOFRecord.sid );
+ sheet.getSheet().getRecords().add( eofLoc, link.record );
}
/**
* Only valid for formula cells
import java.util.Iterator;
import java.util.NoSuchElementException;
-import org.apache.poi.hssf.model.Sheet;
import org.apache.poi.hssf.record.CellValueRecordInterface;
import org.apache.poi.hssf.record.RowRecord;
/**
* reference to containing Sheet
*/
- private Sheet sheet;
+ private HSSFSheet sheet;
/**
* Creates new HSSFRow from scratch. Only HSSFSheet should do this.
* @param rowNum the row number of this row (0 based)
* @see org.apache.poi.hssf.usermodel.HSSFSheet#createRow(int)
*/
- HSSFRow(HSSFWorkbook book, Sheet sheet, int rowNum)
+ HSSFRow(HSSFWorkbook book, HSSFSheet sheet, int rowNum)
{
this.rowNum = rowNum;
this.book = book;
* @param record the low level api object this row should represent
* @see org.apache.poi.hssf.usermodel.HSSFSheet#createRow(int)
*/
- HSSFRow(HSSFWorkbook book, Sheet sheet, RowRecord record)
+ HSSFRow(HSSFWorkbook book, HSSFSheet sheet, RowRecord record)
{
this.book = book;
this.sheet = sheet;
HSSFCell cell = new HSSFCell(book, sheet, getRowNum(), (short)columnIndex, type);
addCell(cell);
- sheet.addValueRecord(getRowNum(), cell.getCellValueRecord());
+ sheet.getSheet().addValueRecord(getRowNum(), cell.getCellValueRecord());
return cell;
}
if(alsoRemoveRecords) {
CellValueRecordInterface cval = cell.getCellValueRecord();
- sheet.removeValueRecord(getRowNum(), cval);
+ sheet.getSheet().removeValueRecord(getRowNum(), cval);
}
if (cell.getCellNum()+1 == row.getLastCol()) {
//The low-order 15 bits contain the row height.
//The 0x8000 bit indicates that the row is standard height (optional)
- if ((height & 0x8000) != 0) height = sheet.getDefaultRowHeight();
+ if ((height & 0x8000) != 0) height = sheet.getSheet().getDefaultRowHeight();
else height &= 0x7FFF;
return height;