mirror of https://github.com/apache/poi.git
Use the link table when looking up external xssf names
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1612347 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
70f40542fd
commit
ea8e44678b
|
@ -135,14 +135,21 @@ public final class XSSFEvaluationWorkbook implements FormulaRenderingWorkbook, E
|
||||||
// External reference - reference is 1 based, link table is 0 based
|
// External reference - reference is 1 based, link table is 0 based
|
||||||
int linkNumber = externalWorkbookNumber - 1;
|
int linkNumber = externalWorkbookNumber - 1;
|
||||||
ExternalLinksTable linkTable = _uBook.getExternalLinksTable().get(linkNumber);
|
ExternalLinksTable linkTable = _uBook.getExternalLinksTable().get(linkNumber);
|
||||||
// TODO Return a more specialised form of this, see bug #56752
|
|
||||||
// Should include the cached values, for in case that book isn't available
|
for (org.apache.poi.ss.usermodel.Name name : linkTable.getDefinedNames()) {
|
||||||
// Should support XSSF stuff lookups
|
if (name.getNameName().equals(nameName)) {
|
||||||
return new ExternalName(nameName, -1, -1);
|
// TODO Return a more specialised form of this, see bug #56752
|
||||||
|
// Should include the cached values, for in case that book isn't available
|
||||||
|
// Should support XSSF stuff lookups
|
||||||
|
return new ExternalName(nameName, -1, name.getSheetIndex());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Name '"+nameName+"' not found in " +
|
||||||
|
"reference to " + linkTable.getLinkedFileName());
|
||||||
} else {
|
} else {
|
||||||
// Internal reference
|
// Internal reference
|
||||||
int nameIdx = _uBook.getNameIndex(nameName);
|
int nameIdx = _uBook.getNameIndex(nameName);
|
||||||
return new ExternalName(nameName, nameIdx, -1); // TODO Is this right?
|
return new ExternalName(nameName, nameIdx, 0); // TODO Is this right?
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue