@Override public String toString() { return getClass().getName() + " [" + formatAsString() + "]"; }
/** * Add ignored errors (usually to suppress them in the UI of a consuming * application). * * @param cell Cell. * @param ignoredErrorTypes Types of error to ignore there. */ public void addIgnoredErrors(CellReference cell, IgnoredErrorType... ignoredErrorTypes) { addIgnoredErrors(cell.formatAsString(), ignoredErrorTypes); }
@Override public String toString() { StringBuffer sb = new StringBuffer(64); CellReference crA = new CellReference(_firstRowIndex, _firstColumnIndex, false, false); CellReference crB = new CellReference(_lastRowIndex, _lastColumnIndex, false, false); sb.append(getClass().getName()); sb.append(" [").append(crA.formatAsString()).append(':').append(crB.formatAsString()).append("]"); return sb.toString(); } }
public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append("[TABLE]\n"); buffer.append(" .range = ").append(getRange()).append("\n"); buffer.append(" .flags = ") .append(HexDump.byteToHex(field_5_flags)).append("\n"); buffer.append(" .alwaysClc= ").append(isAlwaysCalc()).append("\n"); buffer.append(" .reserved = ").append(HexDump.intToHex(field_6_res)).append("\n"); CellReference crRowInput = cr(field_7_rowInputRow, field_8_colInputRow); CellReference crColInput = cr(field_9_rowInputCol, field_10_colInputCol); buffer.append(" .rowInput = ").append(crRowInput.formatAsString()).append("\n"); buffer.append(" .colInput = ").append(crColInput.formatAsString()).append("\n"); buffer.append("[/TABLE]\n"); return buffer.toString(); }
public CellRangeAddress getArrayFormulaRange() { if (_cellType != CellType.FORMULA) { String ref = new CellReference(this).formatAsString(); throw new IllegalStateException("Cell " + ref + " is not part of an array formula."); } return ((FormulaRecordAggregate)_record).getArrayFormulaRange(); }
@Internal public void setCellReference(CellReference ref) { setCellReference(ref.formatAsString()); }
public String toString() { CellReference crA = new CellReference(getFirstRow(), getFirstColumn()); CellReference crB = new CellReference(getLastRow(), getLastColumn()); return getClass().getName() + "[" + crA.formatAsString() + ':' + crB.formatAsString() + "]"; } }
/** * Removes the {@link ArrayRecord} for the cell group containing the specified cell. * The caller should clear (set blank) all cells in the returned range. * @return the range of the array formula which was just removed. Never <code>null</code>. */ public CellRangeAddress8Bit removeArrayFormula(int rowIndex, int columnIndex) { for (ArrayRecord ar : _arrayRecords) { if (ar.isInRange(rowIndex, columnIndex)) { _arrayRecords.remove(ar); return ar.getRange(); } } String ref = new CellReference(rowIndex, columnIndex, false, false).formatAsString(); throw new IllegalArgumentException("Specified cell " + ref + " is not part of an array formula."); }
public String toString() { CellReference cr = new CellReference(getRow(), getColumn()); return getClass().getName() + "[" + _evaluator.getSheetNameRange() + '!' + cr.formatAsString() + "]"; } }
public String toString() { CellReference crA = new CellReference(getFirstRow(), getFirstColumn()); CellReference crB = new CellReference(getLastRow(), getLastColumn()); return getClass().getName() + "[" + _evaluator.getSheetNameRange() + '!' + crA.formatAsString() + ':' + crB.formatAsString() + "]"; }
public ForkedEvaluationCell getOrCreateUpdatableCell(int rowIndex, int columnIndex) { RowColKey key = new RowColKey(rowIndex, columnIndex); ForkedEvaluationCell result = _sharedCellsByRowCol.get(key); if (result == null) { EvaluationCell mcell = _masterSheet.getCell(rowIndex, columnIndex); if (mcell == null) { CellReference cr = new CellReference(rowIndex, columnIndex); throw new UnsupportedOperationException("Underlying cell '" + cr.formatAsString() + "' is missing in master sheet."); } result = new ForkedEvaluationCell(this, mcell); _sharedCellsByRowCol.put(key, result); } return result; }
protected CTSerTx getCTSerTx() { CTSerTx tx = CTSerTx.Factory.newInstance(); switch (titleType) { case CELL_REFERENCE: tx.addNewStrRef().setF(titleRef.formatAsString()); return tx; case STRING: tx.setV(titleValue); return tx; default: throw new IllegalStateException("Unkown title type: " + titleType); } } }
/** * Location of the top left visible cell Location of the top left visible cell in the bottom right * pane (when in Left-to-Right mode). * * @param toprow the top row to show in desktop window pane * @param leftcol the left column to show in desktop window pane */ @Override public void showInPane(int toprow, int leftcol) { final CellReference cellReference = new CellReference(toprow, leftcol); final String cellRef = cellReference.formatAsString(); final CTPane pane = getPane(true); assert(pane != null); pane.setTopLeftCell(cellRef); }
protected String formatReferenceAsString() { // Only make cell references as needed. Memory is an issue CellReference cr = new CellReference(getRow(), getColumn(), !isRowRelative(), !isColRelative()); return cr.formatAsString(); }
/** * Adds the current cell reference to the exception for easier debugging. * Would be nice to get the formula text as well, but that seems to require * too much digging around and casting to get the FormulaRenderingWorkbook. */ private NotImplementedException addExceptionInfo(NotImplementedException inner, int sheetIndex, int rowIndex, int columnIndex) { try { String sheetName = _workbook.getSheetName(sheetIndex); CellReference cr = new CellReference(sheetName, rowIndex, columnIndex, false, false); String msg = "Error evaluating cell " + cr.formatAsString(); return new NotImplementedException(msg, inner); } catch (Exception e) { // avoid bombing out during exception handling LOG.log(POILogger.ERROR, "Can't add exception info", e); return inner; // preserve original exception } } /**
/** * Sets column index of this cell * * @param num column index of this cell */ protected void setCellNum(int num) { checkBounds(num); _cellNum = num; String ref = new CellReference(getRowIndex(), getColumnIndex()).formatAsString(); _cell.setR(ref); }
public CellRangeAddress getArrayFormulaRange() { if (_sharedFormulaRecord != null) { throw new IllegalStateException("not an array formula cell."); } CellReference expRef = _formulaRecord.getFormula().getExpReference(); if (expRef == null) { throw new IllegalStateException("not an array formula cell."); } ArrayRecord arec = _sharedValueManager.getArrayRecord(expRef.getRow(), expRef.getCol()); if (arec == null) { throw new IllegalStateException("ArrayRecord was not found for the locator " + expRef.formatAsString()); } CellRangeAddress8Bit a = arec.getRange(); return new CellRangeAddress(a.getFirstRow(), a.getLastRow(), a.getFirstColumn(),a.getLastColumn()); }
public SharedFormulaGroup(SharedFormulaRecord sfr, CellReference firstCell) { if (!sfr.isInRange(firstCell.getRow(), firstCell.getCol())) { throw new IllegalArgumentException("First formula cell " + firstCell.formatAsString() + " is not shared formula range " + sfr.getRange() + "."); } _sfr = sfr; _firstCell = firstCell; int width = sfr.getLastColumn() - sfr.getFirstColumn() + 1; int height = sfr.getLastRow() - sfr.getFirstRow() + 1; _frAggs = new FormulaRecordAggregate[width * height]; _numberOfFormulas = 0; }
protected final String formatReferenceAsString() { CellReference topLeft = new CellReference(getFirstRow(),getFirstColumn(),!isFirstRowRelative(),!isFirstColRelative()); CellReference botRight = new CellReference(getLastRow(),getLastColumn(),!isLastRowRelative(),!isLastColRelative()); if(AreaReference.isWholeColumnReference(SpreadsheetVersion.EXCEL97, topLeft, botRight)) { return (new AreaReference(topLeft, botRight, SpreadsheetVersion.EXCEL97)).formatAsString(); } return topLeft.formatAsString() + ":" + botRight.formatAsString(); }
public void updateCellReferencesForShifting(String msg){ if(isPartOfArrayFormulaGroup()) notifyArrayFormulaChanging(msg); CalculationChain calcChain = getSheet().getWorkbook().getCalculationChain(); int sheetId = (int)getSheet().sheet.getSheetId(); //remove the reference in the calculation chain if(calcChain != null) calcChain.removeItem(sheetId, getReference()); CTCell ctCell = getCTCell(); String r = new CellReference(getRowIndex(), getColumnIndex()).formatAsString(); ctCell.setR(r); }