package org.apache.poi.xssf.usermodel;
+import java.util.List;
+
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.formula.EvaluationCell;
import org.apache.poi.ss.formula.EvaluationName;
} catch (NumberFormatException e) {}
// Look up an External Link Table for this name
- throw new RuntimeException("Not implemented yet for book " + bookName); // TODO
+ List<ExternalLinksTable> tables = _uBook.getExternalLinksTable();
+ for (int i=0; i<tables.size(); i++) {
+ if (tables.get(i).getLinkedFileName().equals(bookName)) {
+ return i;
+ }
+ }
+ throw new RuntimeException("Book not linked for filename " + bookName);
}
public EvaluationName getName(String name, int sheetIndex) {
// External reference - reference is 1 based, link table is 0 based
int linkNumber = externalWorkbookNumber - 1;
ExternalLinksTable linkTable = _uBook.getExternalLinksTable().get(linkNumber);
- return new ExternalName(nameName, -1, -1); // TODO Finish this
+ // 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, -1);
} else {
// Internal reference
int nameIdx = _uBook.getNameIndex(nameName);
/**
* Formulas which reference named ranges, either in other
* sheets, or workbook scoped but in other workbooks.
- * Currently failing with errors like
+ * Used to fail with with errors like
* org.apache.poi.ss.formula.FormulaParseException: Cell reference expected after sheet name at index 9
* org.apache.poi.ss.formula.FormulaParseException: Parse error near char 0 '[' in specified formula '[0]!NR_Global_B2'. Expected number, string, or defined name
*/