CellRefParts parts = separateRefParts(cellRef); _sheetName = parts.sheetName;
String[] parts = separateRefParts(cellRef); _sheetName = parts[0];
/** * 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 }
CellRefParts parts = separateRefParts(cellRef); _sheetName = parts.sheetName;