作者:球球爱生活0423 | 来源:互联网 | 2023-10-10 13:36
本文整理了Java中org.apache.poi.ss.util.CellReference.parseSheetName()
方法的一些代码示例,展示了CellReference.parseSheetName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CellReference.parseSheetName()
方法的具体详情如下:
包路径:org.apache.poi.ss.util.CellReference
类名称:CellReference
方法名:parseSheetName
CellReference.parseSheetName介绍
暂无
代码示例
代码示例来源:origin: org.apache.poi/poi
/**
* Separates the sheet name, row, and columns from a cell reference string.
*
* @param reference is a string that identifies a cell within the sheet or workbook
* reference may not refer to a cell in an external workbook
* reference may be absolute or relative.
* @return String array of sheetName, column (in ALPHA-26 format), and row
* output column or row elements will contain absolute reference markers if they
* existed in the input reference.
*/
private static CellRefParts separateRefParts(String reference) {
int plingPos = reference.lastIndexOf(SHEET_NAME_DELIMITER);
final String sheetName = parseSheetName(reference, plingPos);
String cell = reference.substring(plingPos+1).toUpperCase(Locale.ROOT);
Matcher matcher = CELL_REF_PATTERN.matcher(cell);
if (!matcher.matches()) {
throw new IllegalArgumentException("Invalid CellReference: " + reference);
}
String col = matcher.group(1);
String row = matcher.group(2);
return new CellRefParts(sheetName, row, col);
}
代码示例来源:origin: com.haulmont.thirdparty/poi
/**
* Separates the row from the columns and returns an array of three Strings. The first element
* is the sheet name. Only the first element may be null. The second element in is the column
* name still in ALPHA-26 number format. The third element is the row.
*/
private static String[] separateRefParts(String reference) {
int plingPos = reference.lastIndexOf(SHEET_NAME_DELIMITER);
String sheetName = parseSheetName(reference, plingPos);
int start = plingPos+1;
int length = reference.length();
int loc = start;
// skip initial dollars
if (reference.charAt(loc)==ABSOLUTE_REFERENCE_MARKER) {
loc++;
}
// step over column name chars until first digit (or dollars) for row number.
for (; loc char ch = reference.charAt(loc);
if (Character.isDigit(ch) || ch == ABSOLUTE_REFERENCE_MARKER) {
break;
}
}
return new String[] {
sheetName,
reference.substring(start,loc),
reference.substring(loc),
};
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Separates the row from the columns and returns an array of three Strings. The first element
* is the sheet name. Only the first element may be null. The second element in is the column
* name still in ALPHA-26 number format. The third element is the row.
*/
private static String[] separateRefParts(String reference) {
int plingPos = reference.lastIndexOf(SHEET_NAME_DELIMITER);
String sheetName = parseSheetName(reference, plingPos);
int start = plingPos+1;
int length = reference.length();
int loc = start;
// skip initial dollars
if (reference.charAt(loc)==ABSOLUTE_REFERENCE_MARKER) {
loc++;
}
// step over column name chars until first digit (or dollars) for row number.
for (; loc char ch = reference.charAt(loc);
if (Character.isDigit(ch) || ch == ABSOLUTE_REFERENCE_MARKER) {
break;
}
}
return new String[] {
sheetName,
reference.substring(start,loc),
reference.substring(loc),
};
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Separates the sheet name, row, and columns from a cell reference string.
*
* @param reference is a string that identifies a cell within the sheet or workbook
* reference may not refer to a cell in an external workbook
* reference may be absolute or relative.
* @return String array of sheetName, column (in ALPHA-26 format), and row
* output column or row elements will contain absolute reference markers if they
* existed in the input reference.
*/
private static CellRefParts separateRefParts(String reference) {
int plingPos = reference.lastIndexOf(SHEET_NAME_DELIMITER);
final String sheetName = parseSheetName(reference, plingPos);
String cell = reference.substring(plingPos+1).toUpperCase(Locale.ROOT);
Matcher matcher = CELL_REF_PATTERN.matcher(cell);
if (!matcher.matches()) {
throw new IllegalArgumentException("Invalid CellReference: " + reference);
}
String col = matcher.group(1);
String row = matcher.group(2);
return new CellRefParts(sheetName, row, col);
}