// use Boolean to have a tri-state for on/off/undefined
private Boolean _hidden = UNDEFINED;
private Boolean _collapsed = UNDEFINED;
+ private int _rowNum;
public SXSSFRow(SXSSFSheet sheet)
{
{
return new CellIterator();
}
+
public boolean hasCustomHeight()
{
return _height!=-1;
@Override
public void setRowNum(int rowNum)
{
- _sheet.changeRowNum(this,rowNum);
+ this._rowNum = rowNum;
+ _sheet.changeRowNum(this, rowNum);
}
/**
@Override
public int getRowNum()
{
- return _sheet.getRowNum(this);
+ return _rowNum;
}
/**
*/
@Override
public CellStyle getRowStyle() {
- if(!isFormatted()) {
- return null;
- }
+ if(!isFormatted()) {
+ return null;
+ }
- return getSheet().getWorkbook().getCellStyleAt(_style);
+ return getSheet().getWorkbook().getCellStyleAt(_style);
}
@Internal
- /*package*/ int getRowStyleIndex() {
+ /*package*/ int getRowStyleIndex() {
return _style;
}
*/
@Override
public void setRowStyle(CellStyle style) {
- if(style == null) {
- _style = -1;
- } else {
- _style = style.getIndex();
- }
+ if(style == null) {
+ _style = -1;
+ } else {
+ _style = style.getIndex();
+ }
}
/**
{
return _sheet;
}
+
//end of interface implementation
+ void setRowNumWithoutUpdatingSheet(int rowNum)
+ {
+ this._rowNum = rowNum;
+ }
/**
* Create an iterator over the cells from [0, getLastCellNum()).
SXSSFRow other = (SXSSFRow) obj;
return (this.getRowNum() == other.getRowNum()) &&
- (this.getSheet() == other.getSheet());
+ (this.getSheet() == other.getSheet());
}
@Override
}
}
-
}
SXSSFRow newRow = new SXSSFRow(this);
+ newRow.setRowNumWithoutUpdatingSheet(rownum);
_rows.put(rownum, newRow);
allFlushed = false;
if(_randomAccessWindowSize >= 0 && _rows.size() > _randomAccessWindowSize) {
*
* <p>
* groupRows requires all rows in the group to be in the current window.
- * This is not always practical. Instead use setRowOutlineLevel to
- * explicitly set the group level. Level 1 is the top level group,
+ * This is not always practical. Instead use setRowOutlineLevel to
+ * explicitly set the group level. Level 1 is the top level group,
* followed by 2, etc. It is up to the user to ensure that level 2
* groups are correctly nested under level 1, etc.
* </p>
// to recalculate the best-fit width for the flushed rows. This is an
// inherent limitation of SXSSF. If having correct auto-sizing is
// critical, the flushed rows would need to be re-read by the read-only
- // XSSF eventmodel (SAX) or the memory-heavy XSSF usermodel (DOM).
+ // XSSF eventmodel (SAX) or the memory-heavy XSSF usermodel (DOM).
final int flushedWidth;
try {
// get the best fit width of rows already flushed to disk
lastFlushedRowNumber = rowIndex;
}
}
+
public void changeRowNum(SXSSFRow row, int newRowNum)
{
-
removeRow(row);
- _rows.put(newRowNum,row);
+ row.setRowNumWithoutUpdatingSheet(newRowNum);
+ _rows.put(newRowNum, row);
}
public int getRowNum(SXSSFRow row)
{
- for (Map.Entry<Integer, SXSSFRow> entry : _rows.entrySet()) {
- if (entry.getValue() == row) {
- return entry.getKey().intValue();
- }
- }
-
- return -1;
+ return row.getRowNum();
}
/**