use of org.apache.poi.ss.formula.udf.IndexedUDFFinder in project poi by apache.
the class BaseXSSFEvaluationWorkbook method resolveNameXText.
@Override
public String resolveNameXText(NameXPtg n) {
int idx = n.getNameIndex();
String name = null;
// First, try to find it as a User Defined Function
IndexedUDFFinder udfFinder = (IndexedUDFFinder) getUDFFinder();
name = udfFinder.getFunctionName(idx);
if (name != null)
return name;
// Otherwise, try it as a named range
XSSFName xname = _uBook.getNameAt(idx);
if (xname != null) {
name = xname.getNameName();
}
return name;
}
use of org.apache.poi.ss.formula.udf.IndexedUDFFinder in project poi by apache.
the class BaseXSSFEvaluationWorkbook method getNameXPtg.
/**
* Return an external name (named range, function, user-defined function) Pxg
*/
@Override
public NameXPxg getNameXPtg(String name, SheetIdentifier sheet) {
// First, try to find it as a User Defined Function
IndexedUDFFinder udfFinder = (IndexedUDFFinder) getUDFFinder();
FreeRefFunction func = udfFinder.findFunction(name);
if (func != null) {
return new NameXPxg(null, name);
}
// Otherwise, try it as a named range
if (sheet == null) {
if (!_uBook.getNames(name).isEmpty()) {
return new NameXPxg(null, name);
}
return null;
}
if (sheet._sheetIdentifier == null) {
// Workbook + Named Range only
int bookIndex = resolveBookIndex(sheet._bookName);
return new NameXPxg(bookIndex, null, name);
}
// Use the sheetname and process
String sheetName = sheet._sheetIdentifier.getName();
if (sheet._bookName != null) {
int bookIndex = resolveBookIndex(sheet._bookName);
return new NameXPxg(bookIndex, sheetName, name);
} else {
return new NameXPxg(sheetName, name);
}
}
Aggregations