public final static int INITIAL_CAPACITY = 20;
/**
- * reference to the low level Sheet object
+ * reference to the low level {@link Sheet} object
*/
- private final Sheet sheet;
+ private final Sheet _sheet;
/** stores rows by zero-based row number */
- private final TreeMap<Integer, HSSFRow> rows;
- protected final Workbook book;
- protected final HSSFWorkbook workbook;
- private int firstrow;
- private int lastrow;
+ private final TreeMap<Integer, HSSFRow> _rows;
+ protected final Workbook _book;
+ protected final HSSFWorkbook _workbook;
+ private int _firstrow;
+ private int _lastrow;
/**
* Creates new HSSFSheet - called by HSSFWorkbook to create a sheet from
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet()
*/
protected HSSFSheet(HSSFWorkbook workbook) {
- sheet = Sheet.createSheet();
- rows = new TreeMap<Integer, HSSFRow>();
- this.workbook = workbook;
- this.book = workbook.getWorkbook();
+ _sheet = Sheet.createSheet();
+ _rows = new TreeMap<Integer, HSSFRow>();
+ this._workbook = workbook;
+ this._book = workbook.getWorkbook();
}
/**
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet()
*/
protected HSSFSheet(HSSFWorkbook workbook, Sheet sheet) {
- this.sheet = sheet;
- rows = new TreeMap<Integer, HSSFRow>();
- this.workbook = workbook;
- this.book = workbook.getWorkbook();
+ this._sheet = sheet;
+ _rows = new TreeMap<Integer, HSSFRow>();
+ this._workbook = workbook;
+ this._book = workbook.getWorkbook();
setPropertiesFromSheet(sheet);
}
HSSFSheet cloneSheet(HSSFWorkbook workbook) {
- return new HSSFSheet(workbook, sheet.cloneSheet());
+ return new HSSFSheet(workbook, _sheet.cloneSheet());
}
/**
* @return the parent workbook
*/
public HSSFWorkbook getWorkbook(){
- return workbook;
+ return _workbook;
}
/**
*/
public HSSFRow createRow(int rownum)
{
- HSSFRow row = new HSSFRow(workbook, this, rownum);
+ HSSFRow row = new HSSFRow(_workbook, this, rownum);
addRow(row, true);
return row;
private HSSFRow createRowFromRecord(RowRecord row)
{
- HSSFRow hrow = new HSSFRow(workbook, this, row);
+ HSSFRow hrow = new HSSFRow(_workbook, this, row);
addRow(hrow, false);
return hrow;
*/
public void removeRow(Row row) {
HSSFRow hrow = (HSSFRow) row;
- if (rows.size() > 0) {
+ if (_rows.size() > 0) {
Integer key = new Integer(row.getRowNum());
- HSSFRow removedRow = rows.remove(key);
+ HSSFRow removedRow = _rows.remove(key);
if (removedRow != row) {
if (removedRow != null) {
- rows.put(key, removedRow);
+ _rows.put(key, removedRow);
}
throw new RuntimeException("Specified row does not belong to this sheet");
}
if (hrow.getRowNum() == getLastRowNum())
{
- lastrow = findLastRow(lastrow);
+ _lastrow = findLastRow(_lastrow);
}
if (hrow.getRowNum() == getFirstRowNum())
{
- firstrow = findFirstRow(firstrow);
+ _firstrow = findFirstRow(_firstrow);
}
- sheet.removeRow(hrow.getRowRecord());
+ _sheet.removeRow(hrow.getRowRecord());
}
}
private void addRow(HSSFRow row, boolean addLow)
{
- rows.put(new Integer(row.getRowNum()), row);
+ _rows.put(new Integer(row.getRowNum()), row);
if (addLow)
{
- sheet.addRow(row.getRowRecord());
+ _sheet.addRow(row.getRowRecord());
}
if (row.getRowNum() > getLastRowNum())
{
- lastrow = row.getRowNum();
+ _lastrow = row.getRowNum();
}
if (row.getRowNum() < getFirstRowNum())
{
- firstrow = row.getRowNum();
+ _firstrow = row.getRowNum();
}
}
* @return HSSFRow representing the row number or null if its not defined on the sheet
*/
public HSSFRow getRow(int rowIndex) {
- return rows.get(new Integer(rowIndex));
+ return _rows.get(new Integer(rowIndex));
}
/**
* Returns the number of physically defined rows (NOT the number of rows in the sheet)
*/
public int getPhysicalNumberOfRows() {
- return rows.size();
+ return _rows.size();
}
/**
* @return the number of the first logical row on the sheet, zero based
*/
public int getFirstRowNum() {
- return firstrow;
+ return _firstrow;
}
/**
* @return the number of the last row contained in this sheet, zero based.
*/
public int getLastRowNum() {
- return lastrow;
+ return _lastrow;
}
/**
if (dataValidation == null) {
throw new IllegalArgumentException("objValidation must not be null");
}
- DataValidityTable dvt = sheet.getOrCreateDataValidityTable();
+ DataValidityTable dvt = _sheet.getOrCreateDataValidityTable();
DVRecord dvRecord = dataValidation.createDVRecord(this);
dvt.addDataValidation(dvRecord);
* @param hidden - the visiblity state of the column
*/
public void setColumnHidden(int columnIndex, boolean hidden) {
- sheet.setColumnHidden(columnIndex, hidden);
+ _sheet.setColumnHidden(columnIndex, hidden);
}
/**
* @return hidden - <code>false</code> if the column is visible
*/
public boolean isColumnHidden(int columnIndex) {
- return sheet.isColumnHidden(columnIndex);
+ return _sheet.isColumnHidden(columnIndex);
}
/**
* @throws IllegalArgumentException if width > 65536 (the maximum column width in Excel)
*/
public void setColumnWidth(int columnIndex, int width) {
- sheet.setColumnWidth(columnIndex, width);
+ _sheet.setColumnWidth(columnIndex, width);
}
/**
* @return width - the width in units of 1/256th of a character width
*/
public int getColumnWidth(int columnIndex) {
- return sheet.getColumnWidth(columnIndex);
+ return _sheet.getColumnWidth(columnIndex);
}
/**
* @return default column width
*/
public int getDefaultColumnWidth() {
- return sheet.getDefaultColumnWidth();
+ return _sheet.getDefaultColumnWidth();
}
/**
* set the default column width for the sheet (if the columns do not define their own width) in
* @param width default column width
*/
public void setDefaultColumnWidth(int width) {
- sheet.setDefaultColumnWidth(width);
+ _sheet.setDefaultColumnWidth(width);
}
* @return default row height
*/
public short getDefaultRowHeight() {
- return sheet.getDefaultRowHeight();
+ return _sheet.getDefaultRowHeight();
}
/**
public float getDefaultRowHeightInPoints()
{
- return (sheet.getDefaultRowHeight() / 20);
+ return (_sheet.getDefaultRowHeight() / 20);
}
/**
public void setDefaultRowHeight(short height)
{
- sheet.setDefaultRowHeight(height);
+ _sheet.setDefaultRowHeight(height);
}
/**
public void setDefaultRowHeightInPoints(float height)
{
- sheet.setDefaultRowHeight((short) (height * 20));
+ _sheet.setDefaultRowHeight((short) (height * 20));
}
/**
* set for that column
*/
public HSSFCellStyle getColumnStyle(int column) {
- short styleIndex = sheet.getXFIndexForColAt((short)column);
+ short styleIndex = _sheet.getXFIndexForColAt((short)column);
if(styleIndex == 0xf) {
// None set
return null;
}
- ExtendedFormatRecord xf = book.getExFormatAt(styleIndex);
- return new HSSFCellStyle(styleIndex, xf, book);
+ ExtendedFormatRecord xf = _book.getExFormatAt(styleIndex);
+ return new HSSFCellStyle(styleIndex, xf, _book);
}
/**
public boolean isGridsPrinted()
{
- return sheet.isGridsPrinted();
+ return _sheet.isGridsPrinted();
}
/**
public void setGridsPrinted(boolean value)
{
- sheet.setGridsPrinted(value);
+ _sheet.setGridsPrinted(value);
}
/**
*/
public int addMergedRegion(org.apache.poi.ss.util.Region region)
{
- return sheet.addMergedRegion( region.getRowFrom(),
+ return _sheet.addMergedRegion( region.getRowFrom(),
region.getColumnFrom(),
//(short) region.getRowTo(),
region.getRowTo(),
*/
public int addMergedRegion(CellRangeAddress region)
{
- return sheet.addMergedRegion( region.getFirstRow(),
+ return _sheet.addMergedRegion( region.getFirstRow(),
region.getFirstColumn(),
region.getLastRow(),
region.getLastColumn());
*/
public void setForceFormulaRecalculation(boolean value)
{
- sheet.setUncalced(value);
+ _sheet.setUncalced(value);
}
/**
* Whether a record must be inserted or not at generation to indicate that
*/
public boolean getForceFormulaRecalculation()
{
- return sheet.getUncalced();
+ return _sheet.getUncalced();
}
public void setVerticallyCenter(boolean value)
{
- sheet.getPageSettings().getVCenter().setVCenter(value);
+ _sheet.getPageSettings().getVCenter().setVCenter(value);
}
/**
*/
public boolean getVerticallyCenter()
{
- return sheet.getPageSettings().getVCenter().getVCenter();
+ return _sheet.getPageSettings().getVCenter().getVCenter();
}
/**
public void setHorizontallyCenter(boolean value)
{
- sheet.getPageSettings().getHCenter().setHCenter(value);
+ _sheet.getPageSettings().getHCenter().setHCenter(value);
}
/**
public boolean getHorizontallyCenter()
{
- return sheet.getPageSettings().getHCenter().getHCenter();
+ return _sheet.getPageSettings().getHCenter().getHCenter();
}
public void removeMergedRegion(int index)
{
- sheet.removeMergedRegion(index);
+ _sheet.removeMergedRegion(index);
}
/**
public int getNumMergedRegions()
{
- return sheet.getNumMergedRegions();
+ return _sheet.getNumMergedRegions();
}
/**
* @return the merged region at the specified index
*/
public CellRangeAddress getMergedRegion(int index) {
- return sheet.getMergedRegionAt(index);
+ return _sheet.getMergedRegionAt(index);
}
/**
*/
public Iterator<Row> rowIterator() {
@SuppressWarnings("unchecked") // can this clumsy generic syntax be improved?
- Iterator<Row> result = (Iterator<Row>)(Iterator<? extends Row>)rows.values().iterator();
+ Iterator<Row> result = (Iterator<Row>)(Iterator<? extends Row>)_rows.values().iterator();
return result;
}
/**
* @return Sheet - low level representation of this HSSFSheet.
*/
Sheet getSheet() {
- return sheet;
+ return _sheet;
}
/**
*/
public void setAlternativeExpression(boolean b) {
WSBoolRecord record =
- (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+ (WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
record.setAlternateExpression(b);
}
*/
public void setAlternativeFormula(boolean b) {
WSBoolRecord record =
- (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+ (WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
record.setAlternateFormula(b);
}
*/
public void setAutobreaks(boolean b) {
WSBoolRecord record =
- (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+ (WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
record.setAutobreaks(b);
}
*/
public void setDialog(boolean b) {
WSBoolRecord record =
- (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+ (WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
record.setDialog(b);
}
*/
public void setDisplayGuts(boolean b) {
WSBoolRecord record =
- (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+ (WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
record.setDisplayGuts(b);
}
*/
public void setFitToPage(boolean b) {
WSBoolRecord record =
- (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+ (WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
record.setFitToPage(b);
}
*/
public void setRowSumsBelow(boolean b) {
WSBoolRecord record =
- (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+ (WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
record.setRowSumsBelow(b);
}
*/
public void setRowSumsRight(boolean b) {
WSBoolRecord record =
- (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+ (WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
record.setRowSumsRight(b);
}
* @return alternative expression evaluation or not
*/
public boolean getAlternateExpression() {
- return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+ return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getAlternateExpression();
}
* @return alternative formulas or not
*/
public boolean getAlternateFormula() {
- return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+ return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getAlternateFormula();
}
* @return whether to show auto page breaks
*/
public boolean getAutobreaks() {
- return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+ return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getAutobreaks();
}
* @return isDialog or not
*/
public boolean getDialog() {
- return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+ return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getDialog();
}
* @return guts or no guts (or glory)
*/
public boolean getDisplayGuts() {
- return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+ return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getDisplayGuts();
}
* @return fit or not
*/
public boolean getFitToPage() {
- return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+ return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getFitToPage();
}
* @return below or not
*/
public boolean getRowSumsBelow() {
- return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+ return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getRowSumsBelow();
}
* @return right or not
*/
public boolean getRowSumsRight() {
- return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
+ return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getRowSumsRight();
}
* @return The user model for the print setup object.
*/
public HSSFPrintSetup getPrintSetup() {
- return new HSSFPrintSetup(sheet.getPageSettings().getPrintSetup());
+ return new HSSFPrintSetup(_sheet.getPageSettings().getPrintSetup());
}
/**
* @return The Document header.
*/
public HSSFHeader getHeader() {
- return new HSSFHeader(sheet.getPageSettings().getHeader());
+ return new HSSFHeader(_sheet.getPageSettings().getHeader());
}
/**
* @return The Document footer.
*/
public HSSFFooter getFooter() {
- return new HSSFFooter(sheet.getPageSettings().getFooter());
+ return new HSSFFooter(_sheet.getPageSettings().getFooter());
}
/**
* @return the size of the margin
*/
public double getMargin(short margin) {
- return sheet.getPageSettings().getMargin(margin);
+ return _sheet.getPageSettings().getMargin(margin);
}
/**
* @param size the size of the margin
*/
public void setMargin(short margin, double size) {
- sheet.getPageSettings().setMargin(margin, size);
+ _sheet.getPageSettings().setMargin(margin, size);
}
/**
* @return short indicating the rownum (0 based) of the top row
*/
public short getTopRow() {
- return sheet.getTopRow();
+ return _sheet.getTopRow();
}
/**
* @return short indicating the rownum (0 based) of the top row
*/
public short getLeftCol() {
- return sheet.getLeftCol();
+ return _sheet.getLeftCol();
}
/**
* @param leftcol the left column to show in desktop window pane
*/
public void showInPane(short toprow, short leftcol){
- sheet.setTopRow(toprow);
- sheet.setLeftCol(leftcol);
+ _sheet.setTopRow(toprow);
+ _sheet.setLeftCol(leftcol);
}
/**
}
//read so it doesn't get shifted again
- Iterator iterator = shiftedRegions.iterator();
+ Iterator<CellRangeAddress> iterator = shiftedRegions.iterator();
while (iterator.hasNext()) {
- CellRangeAddress region = (CellRangeAddress)iterator.next();
+ CellRangeAddress region = iterator.next();
this.addMergedRegion(region);
}
}
NoteRecord[] noteRecs;
if (moveComments) {
- noteRecs = sheet.getNoteRecords();
+ noteRecs = _sheet.getNoteRecords();
} else {
noteRecs = NoteRecord.EMPTY_ARRAY;
}
shiftMerged(startRow, endRow, n, true);
- sheet.getPageSettings().shiftRowBreaks(startRow, endRow, n);
+ _sheet.getPageSettings().shiftRowBreaks(startRow, endRow, n);
for ( int rowNum = s; rowNum >= startRow && rowNum <= endRow && rowNum >= 0 && rowNum < 65536; rowNum += inc ) {
HSSFRow row = getRow( rowNum );
CellValueRecordInterface cellRecord = cell.getCellValueRecord();
cellRecord.setRow( rowNum + n );
row2Replace.createCellFromRecord( cellRecord );
- sheet.addValueRecord( rowNum + n, cellRecord );
+ _sheet.addValueRecord( rowNum + n, cellRecord );
HSSFHyperlink link = cell.getHyperlink();
if(link != null){
}
}
}
- if ( endRow == lastrow || endRow + n > lastrow ) lastrow = Math.min( endRow + n, 65535 );
- if ( startRow == firstrow || startRow + n < firstrow ) firstrow = Math.max( startRow + n, 0 );
+ if ( endRow == _lastrow || endRow + n > _lastrow ) _lastrow = Math.min( endRow + n, 65535 );
+ if ( startRow == _firstrow || startRow + n < _firstrow ) _firstrow = Math.max( startRow + n, 0 );
// Update any formulas on this sheet that point to
// rows which have been moved
- int sheetIndex = workbook.getSheetIndex(this);
- short externSheetIndex = book.checkExternSheet(sheetIndex);
+ int sheetIndex = _workbook.getSheetIndex(this);
+ short externSheetIndex = _book.checkExternSheet(sheetIndex);
FormulaShifter shifter = FormulaShifter.createForRowShift(externSheetIndex, startRow, endRow, n);
- sheet.updateFormulasAfterCellShift(shifter, externSheetIndex);
+ _sheet.updateFormulasAfterCellShift(shifter, externSheetIndex);
- int nSheets = workbook.getNumberOfSheets();
+ int nSheets = _workbook.getNumberOfSheets();
for(int i=0; i<nSheets; i++) {
- Sheet otherSheet = workbook.getSheetAt(i).getSheet();
- if (otherSheet == this.sheet) {
+ Sheet otherSheet = _workbook.getSheetAt(i).getSheet();
+ if (otherSheet == this._sheet) {
continue;
}
- short otherExtSheetIx = book.checkExternSheet(i);
+ short otherExtSheetIx = _book.checkExternSheet(i);
otherSheet.updateFormulasAfterCellShift(shifter, otherExtSheetIx);
}
// TODO - adjust formulas in named ranges
}
protected void insertChartRecords(List<Record> records) {
- int window2Loc = sheet.findFirstRecordLocBySid(WindowTwoRecord.sid);
- sheet.getRecords().addAll(window2Loc, records);
+ int window2Loc = _sheet.findFirstRecordLocBySid(WindowTwoRecord.sid);
+ _sheet.getRecords().addAll(window2Loc, records);
}
/**
* @param show whether to show gridlines or not
*/
public void setDisplayGridlines(boolean show) {
- sheet.setDisplayGridlines(show);
+ _sheet.setDisplayGridlines(show);
}
/**
* @return whether gridlines are displayed
*/
public boolean isDisplayGridlines() {
- return sheet.isDisplayGridlines();
+ return _sheet.isDisplayGridlines();
}
/**
* @param show whether to show formulas or not
*/
public void setDisplayFormulas(boolean show) {
- sheet.setDisplayFormulas(show);
+ _sheet.setDisplayFormulas(show);
}
/**
* @return whether formulas are displayed
*/
public boolean isDisplayFormulas() {
- return sheet.isDisplayFormulas();
+ return _sheet.isDisplayFormulas();
}
/**
* @param show whether to show RowColHeadings or not
*/
public void setDisplayRowColHeadings(boolean show) {
- sheet.setDisplayRowColHeadings(show);
+ _sheet.setDisplayRowColHeadings(show);
}
/**
* @return whether RowColHeadings are displayed
*/
public boolean isDisplayRowColHeadings() {
- return sheet.isDisplayRowColHeadings();
+ return _sheet.isDisplayRowColHeadings();
}
/**
*/
public void setRowBreak(int row) {
validateRow(row);
- sheet.getPageSettings().setRowBreak(row, (short)0, (short)255);
+ _sheet.getPageSettings().setRowBreak(row, (short)0, (short)255);
}
/**
* @return <code>true</code> if there is a page break at the indicated row
*/
public boolean isRowBroken(int row) {
- return sheet.getPageSettings().isRowBroken(row);
+ return _sheet.getPageSettings().isRowBroken(row);
}
/**
* Removes the page break at the indicated row
*/
public void removeRowBreak(int row) {
- sheet.getPageSettings().removeRowBreak(row);
+ _sheet.getPageSettings().removeRowBreak(row);
}
/**
*/
public int[] getRowBreaks() {
//we can probably cache this information, but this should be a sparsely used function
- return sheet.getPageSettings().getRowBreaks();
+ return _sheet.getPageSettings().getRowBreaks();
}
/**
*/
public int[] getColumnBreaks() {
//we can probably cache this information, but this should be a sparsely used function
- return sheet.getPageSettings().getColumnBreaks();
+ return _sheet.getPageSettings().getColumnBreaks();
}
*/
public void setColumnBreak(short column) {
validateColumn(column);
- sheet.getPageSettings().setColumnBreak(column, (short)0, (short)65535);
+ _sheet.getPageSettings().setColumnBreak(column, (short)0, (short)65535);
}
/**
* @return FIXME: Document this!
*/
public boolean isColumnBroken(short column) {
- return sheet.getPageSettings().isColumnBroken(column);
+ return _sheet.getPageSettings().isColumnBroken(column);
}
/**
* @param column
*/
public void removeColumnBreak(short column) {
- sheet.getPageSettings().removeColumnBreak(column);
+ _sheet.getPageSettings().removeColumnBreak(column);
}
/**
* to the standard output.
*/
public void dumpDrawingRecords(boolean fat) {
- sheet.aggregateDrawingRecords(book.getDrawingManager(), false);
+ _sheet.aggregateDrawingRecords(_book.getDrawingManager(), false);
EscherAggregate r = (EscherAggregate) getSheet().findFirstRecordBySid(EscherAggregate.sid);
- List escherRecords = r.getEscherRecords();
+ List<EscherRecord> escherRecords = r.getEscherRecords();
PrintWriter w = new PrintWriter(System.out);
- for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); )
- {
- EscherRecord escherRecord = (EscherRecord) iterator.next();
- if (fat)
- System.out.println(escherRecord.toString());
- else
- escherRecord.display(w, 0);
+ for (Iterator<EscherRecord> iterator = escherRecords.iterator(); iterator.hasNext();) {
+ EscherRecord escherRecord = iterator.next();
+ if (fat) {
+ System.out.println(escherRecord.toString());
+ } else {
+ escherRecord.display(w, 0);
+ }
}
w.flush();
}
*/
public HSSFPatriarch createDrawingPatriarch() {
// Create the drawing group if it doesn't already exist.
- book.createDrawingGroup();
+ _book.createDrawingGroup();
- sheet.aggregateDrawingRecords(book.getDrawingManager(), true);
- EscherAggregate agg = (EscherAggregate) sheet.findFirstRecordBySid(EscherAggregate.sid);
+ _sheet.aggregateDrawingRecords(_book.getDrawingManager(), true);
+ EscherAggregate agg = (EscherAggregate) _sheet.findFirstRecordBySid(EscherAggregate.sid);
HSSFPatriarch patriarch = new HSSFPatriarch(this, agg);
agg.clear(); // Initially the behaviour will be to clear out any existing shapes in the sheet when
// creating a new patriarch.
* certainly be lost or corrupted when written out.
*/
public EscherAggregate getDrawingEscherAggregate() {
- book.findDrawingGroup();
+ _book.findDrawingGroup();
// If there's now no drawing manager, then there's
// no drawing escher records on the workbook
- if(book.getDrawingManager() == null) {
+ if(_book.getDrawingManager() == null) {
return null;
}
- int found = sheet.aggregateDrawingRecords(
- book.getDrawingManager(), false
+ int found = _sheet.aggregateDrawingRecords(
+ _book.getDrawingManager(), false
);
if(found == -1) {
// Workbook has drawing stuff, but this sheet doesn't
}
// Grab our aggregate record, and wire it up
- EscherAggregate agg = (EscherAggregate) sheet.findFirstRecordBySid(EscherAggregate.sid);
+ EscherAggregate agg = (EscherAggregate) _sheet.findFirstRecordBySid(EscherAggregate.sid);
return agg;
}
* @param collapsed true = collapse group, false = expand group.
*/
public void setColumnGroupCollapsed(int columnNumber, boolean collapsed) {
- sheet.setColumnGroupCollapsed(columnNumber, collapsed);
+ _sheet.setColumnGroupCollapsed(columnNumber, collapsed);
}
/**
* @param toColumn end of the column range.
*/
public void groupColumn(int fromColumn, int toColumn) {
- sheet.groupColumnRange(fromColumn, toColumn, true);
+ _sheet.groupColumnRange(fromColumn, toColumn, true);
}
public void ungroupColumn(int fromColumn, int toColumn) {
- sheet.groupColumnRange(fromColumn, toColumn, false);
+ _sheet.groupColumnRange(fromColumn, toColumn, false);
}
/**
* @param toRow end row (0-based)
*/
public void groupRow(int fromRow, int toRow) {
- sheet.groupRowRange(fromRow, toRow, true);
+ _sheet.groupRowRange(fromRow, toRow, true);
}
public void ungroupRow(int fromRow, int toRow) {
- sheet.groupRowRange(fromRow, toRow, false);
+ _sheet.groupRowRange(fromRow, toRow, false);
}
public void setRowGroupCollapsed(int rowIndex, boolean collapse) {
if (collapse) {
- sheet.getRowsAggregate().collapseRow(rowIndex);
+ _sheet.getRowsAggregate().collapseRow(rowIndex);
} else {
- sheet.getRowsAggregate().expandRow(rowIndex);
+ _sheet.getRowsAggregate().expandRow(rowIndex);
}
}
* @param style the style to set
*/
public void setDefaultColumnStyle(int column, CellStyle style) {
- sheet.setDefaultColumnStyle(column, ((HSSFCellStyle)style).getIndex());
+ _sheet.setDefaultColumnStyle(column, ((HSSFCellStyle)style).getIndex());
}
/**
FontRenderContext frc = new FontRenderContext(null, true, true);
- HSSFWorkbook wb = new HSSFWorkbook(book);
+ HSSFWorkbook wb = new HSSFWorkbook(_book);
HSSFFont defaultFont = wb.getFontAt((short) 0);
str = new AttributedString("" + defaultChar);
double width = -1;
rows:
- for (Iterator it = rowIterator(); it.hasNext();) {
+ for (Iterator<Row> it = rowIterator(); it.hasNext();) {
HSSFRow row = (HSSFRow) it.next();
HSSFCell cell = row.getCell(column);
if (width > Short.MAX_VALUE) { //width can be bigger that Short.MAX_VALUE!
width = Short.MAX_VALUE;
}
- sheet.setColumnWidth(column, (short) (width));
+ _sheet.setColumnWidth(column, (short) (width));
}
}
HSSFCell c = r.getCell(column);
if(c != null) {
return c.getCellComment();
- } else {
- // No cell, so you will get new
- // objects every time, sorry...
- return HSSFCell.findCellComment(sheet, row, column);
}
+ // No cell, so you will get new
+ // objects every time, sorry...
+ return HSSFCell.findCellComment(_sheet, row, column);
}
return null;
}