/** * Creates an HSSFRow from a low level RowRecord object. Only HSSFSheet should do * this. HSSFSheet uses this when an existing file is read in. * * @param book low-level Workbook object containing the sheet that contains this row * @param sheet low-level Sheet object that contains this Row * @param record the low level api object this row should represent * @see org.apache.poi.hssf.usermodel.HSSFSheet#createRow(int) */ HSSFRow(HSSFWorkbook book, HSSFSheet sheet, RowRecord record) { this.book = book; this.sheet = sheet; row = record; setRowNum(record.getRowNumber()); // Size the initial cell list such that a read only case won't waste // lots of memory, and a create/read followed by adding new cells can // add a bit without needing a resize cells = new HSSFCell[record.getLastCol()+INITIAL_CAPACITY]; // Don't trust colIx boundaries as read by other apps // set the RowRecord empty for the moment record.setEmpty(); // subsequent calls to createCellFromRecord() will update the colIx boundaries properly }
int newrownum=0; for (int i=0; i<=sheet.sheet.getLastRowNum(); i++) { HSSFRow row=sheet.getRow(i); if (row) row.setRowNum(newrownum++); }
/** * Creates an HSSFRow from a low level RowRecord object. Only HSSFSheet should do * this. HSSFSheet uses this when an existing file is read in. * * @param book low-level Workbook object containing the sheet that contains this row * @param sheet low-level Sheet object that contains this Row * @param record the low level api object this row should represent * @see org.apache.poi.hssf.usermodel.HSSFSheet#createRow(int) */ HSSFRow(HSSFWorkbook book, HSSFSheet sheet, RowRecord record) { this.book = book; this.sheet = sheet; row = record; setRowNum(record.getRowNumber()); // Size the initial cell list such that a read only case won't waste // lots of memory, and a create/read followed by adding new cells can // add a bit without needing a resize cells = new HSSFCell[record.getLastCol()+INITIAL_CAPACITY]; // Don't trust colIx boundaries as read by other apps // set the RowRecord empty for the moment record.setEmpty(); // subsequent calls to createCellFromRecord() will update the colIx boundaries properly }
/** * Creates an HSSFRow from a low level RowRecord object. Only HSSFSheet should do * this. HSSFSheet uses this when an existing file is read in. * * @param book low-level Workbook object containing the sheet that contains this row * @param sheet low-level Sheet object that contains this Row * @param record the low level api object this row should represent * @see org.apache.poi.hssf.usermodel.HSSFSheet#createRow(int) */ HSSFRow(HSSFWorkbook book, HSSFSheet sheet, RowRecord record) { this.book = book; this.sheet = sheet; row = record; setRowNum(record.getRowNumber()); // Size the initial cell list such that a read only case won't waste // lots of memory, and a create/read followed by adding new cells can // add a bit without needing a resize cells = new HSSFCell[record.getLastCol()+INITIAL_CAPACITY]; // Don't trust colIx boundaries as read by other apps // set the RowRecord empty for the moment record.setEmpty(); // subsequent calls to createCellFromRecord() will update the colIx boundaries properly }
/** * Creates an HSSFRow from a low level RowRecord object. Only HSSFSheet should do * this. HSSFSheet uses this when an existing file is read in. * * @param book low-level Workbook object containing the sheet that contains this row * @param sheet low-level Sheet object that contains this Row * @param record the low level api object this row should represent * @see org.apache.poi.hssf.usermodel.HSSFSheet#createRow(int) */ HSSFRow(HSSFWorkbook book, HSSFSheet sheet, RowRecord record) { this.book = book; this.sheet = sheet; row = record; setRowNum(record.getRowNumber()); // Size the initial cell list such that a read only case won't waste // lots of memory, and a create/read followed by adding new cells can // add a bit without needing a resize cells = new HSSFCell[record.getLastCol()+INITIAL_CAPACITY]; // Don't trust colIx boundaries as read by other apps // set the RowRecord empty for the moment record.setEmpty(); // subsequent calls to createCellFromRecord() will update the colIx boundaries properly }