private static int parseRowRef(String refStrPart) { return CellReference.convertColStringToIndex(refStrPart); }
/** * Create a new CellAddress object. * * @param address a cell address in A1 format. Address may not contain sheet name or dollar signs. * (that is, address is not a cell reference. Use {@link #CellAddress(CellReference)} instead if * starting with a cell reference.) */ public CellAddress(String address) { int length = address.length(); int loc = 0; // step over column name chars until first digit for row number. for (; loc < length; loc++) { char ch = address.charAt(loc); if (Character.isDigit(ch)) { break; } } String sCol = address.substring(0,loc).toUpperCase(Locale.ROOT); String sRow = address.substring(loc); // FIXME: breaks if address contains a sheet name or dollar signs from an absolute CellReference this._row = Integer.parseInt(sRow)-1; this._col = CellReference.convertColStringToIndex(sCol); }
_colIndex = -1; } else { _colIndex = convertColStringToIndex(colRef);
boolean lastIsAbs = CellReference.isPartAbsolute(part1); int col0 = CellReference.convertColStringToIndex(part0); int col1 = CellReference.convertColStringToIndex(part1);
public int getColIndex(String colString) { return CellReference.convertColStringToIndex(colString); }
private static int parseRowRef(String refStrPart) { return CellReference.convertColStringToIndex(refStrPart); }
private static int parseRowRef(String refStrPart) { return CellReference.convertColStringToIndex(refStrPart); }
private static int parseRowRef(String refStrPart) { return CellReference.convertColStringToIndex(refStrPart); }
public static int convertReferenceStringToInt(String ref) { return CellReference.convertColStringToIndex(ref); }
public static MergeCellRegion create(String startCell, String endCell) { int startCellIndex = ExcelUtil.getRowNumberStartIndex(startCell); int endCellIndex = ExcelUtil.getRowNumberStartIndex(endCell); return new MergeCellRegion( convertColStringToIndex(startCell.substring(0, startCellIndex)), convertColStringToIndex(endCell.substring(0, endCellIndex)), Integer.parseInt(startCell.substring(startCellIndex)), Integer.parseInt(endCell.substring(endCellIndex)) ); }
/** * Create a new CellAddress object. * * @param address a cell address in A1 format. Address may not contain sheet name or dollar signs. * (that is, address is not a cell reference. Use {@link #CellAddress(CellReference)} instead if * starting with a cell reference.) */ public CellAddress(String address) { int length = address.length(); int loc = 0; // step over column name chars until first digit for row number. for (; loc < length; loc++) { char ch = address.charAt(loc); if (Character.isDigit(ch)) { break; } } String sCol = address.substring(0,loc).toUpperCase(Locale.ROOT); String sRow = address.substring(loc); // FIXME: breaks if address contains a sheet name or dollar signs from an absolute CellReference this._row = Integer.parseInt(sRow)-1; this._col = CellReference.convertColStringToIndex(sCol); }
/** * Helper method to handle start of the "cell" element. It reads required attributes and set the workspace * variables. */ private void handleCellStart() { final String typeValue = xmlStreamReader.getAttributeValue(/*namespaceURI=*/null, ExcelUtil.TYPE); lookupNextValueInSST = ExcelUtil.SST_STRING.equals(typeValue); determineOutputTypes( typeValue, xmlStreamReader.getAttributeValue(/*namespaceURI=*/null, ExcelUtil.STYLE)); currentCellRef = xmlStreamReader.getAttributeValue(/*namespaceURI=*/null, ExcelUtil.CELL_REF); String columnName = ExcelUtil.getColumnName(currentCellRef); currentColumnIndex = CellReference.convertColStringToIndex(columnName); }
public MergedRegion(String region) { String[] refs = region.split(":"); assert(refs.length == 2); topLeftRef = refs[0]; bottomRightRef = refs[1]; parseTopLeft(topLeftRef); parseBottomRight(bottomRightRef); rowHeigthDifference = bottomRightRow - topLeftRow; verticalRange = new SimpleRange(topLeftRow - 1, bottomRightRow - 1); int topRef = CellReference.convertColStringToIndex(topLeftCol); int bottomRef = CellReference.convertColStringToIndex(bottomRightCol); horizontalRange = new SimpleRange(topRef, bottomRef); }
/** * Create an cell ref from a string representation. Sheet names containing special characters should be * delimited and escaped as per normal syntax rules for formulas. */ public CellReference(String cellRef) { if(cellRef.endsWith("#REF!")) { throw new IllegalArgumentException("Cell reference invalid: " + cellRef); } String[] parts = separateRefParts(cellRef); _sheetName = parts[0]; String colRef = parts[1]; if (colRef.length() < 1) { throw new IllegalArgumentException("Invalid Formula cell reference: '"+cellRef+"'"); } _isColAbs = colRef.charAt(0) == '$'; if (_isColAbs) { colRef=colRef.substring(1); } _colIndex = convertColStringToIndex(colRef); String rowRef=parts[2]; if (rowRef.length() < 1) { throw new IllegalArgumentException("Invalid Formula cell reference: '"+cellRef+"'"); } _isRowAbs = rowRef.charAt(0) == '$'; if (_isRowAbs) { rowRef=rowRef.substring(1); } _rowIndex = Integer.parseInt(rowRef)-1; // -1 to convert 1-based to zero-based }
_colIndex = -1; } else { _colIndex = convertColStringToIndex(colRef);
_colIndex = -1; } else { _colIndex = convertColStringToIndex(colRef);
columnIndex = CellReference.convertColStringToIndex(columnNameFromRef);
boolean lastIsAbs = CellReference.isPartAbsolute(part1); int col0 = CellReference.convertColStringToIndex(part0); int col1 = CellReference.convertColStringToIndex(part1);
boolean lastIsAbs = CellReference.isPartAbsolute(part1); int col0 = CellReference.convertColStringToIndex(part0); int col1 = CellReference.convertColStringToIndex(part1);
boolean lastIsAbs = CellReference.isPartAbsolute(part1); int col0 = CellReference.convertColStringToIndex(part0); int col1 = CellReference.convertColStringToIndex(part1);