}
return sheet;
}
- public ExternalSheet getExternalSheet(String sheetName, int externalWorkbookNumber) {
+ public ExternalSheet getExternalSheet(String firstSheetName, String lastSheetName, int externalWorkbookNumber) {
throw new IllegalStateException("XSSF-style external references are not supported for HSSF");
}
* XSSF Only - fetch the external-style sheet details
* <p>Return will have no workbook set if it's actually in our own workbook</p>
*/
- ExternalSheet getExternalSheet(String sheetName, int externalWorkbookNumber);
+ ExternalSheet getExternalSheet(String firstSheetName, String lastSheetName, int externalWorkbookNumber);
/**
* HSSF Only - convert an external sheet index to an internal sheet index,
* for an external-style reference to one of this workbook's own sheets
return createExternSheetRefEvaluator(ptg.getExternSheetIndex());
}
SheetRefEvaluator createExternSheetRefEvaluator(String sheetName, int externalWorkbookNumber) {
- ExternalSheet externalSheet = _workbook.getExternalSheet(sheetName, externalWorkbookNumber);
+ ExternalSheet externalSheet = _workbook.getExternalSheet(sheetName, null, externalWorkbookNumber);
return createExternSheetRefEvaluator(externalSheet);
}
SheetRefEvaluator createExternSheetRefEvaluator(int externSheetIndex) {
return getExternalNameXEval(externName, workbookName);
}
public ValueEval getNameXEval(NameXPxg nameXPxg) {
- ExternalSheet externSheet = _workbook.getExternalSheet(nameXPxg.getSheetName(), nameXPxg.getExternalWorkbookNumber());
+ ExternalSheet externSheet = _workbook.getExternalSheet(nameXPxg.getSheetName(), null, nameXPxg.getExternalWorkbookNumber());
if(externSheet == null || externSheet.getWorkbookName() == null) {
// External reference to our own workbook's name
return getLocalNameXEval(nameXPxg);
public ExternalSheet getExternalSheet(int externSheetIndex) {
return _masterBook.getExternalSheet(externSheetIndex);
}
- public ExternalSheet getExternalSheet(String sheetName, int externalWorkbookNumber) {
- return _masterBook.getExternalSheet(sheetName, externalWorkbookNumber);
+ public ExternalSheet getExternalSheet(String firstSheetName, String lastSheetName, int externalWorkbookNumber) {
+ return _masterBook.getExternalSheet(firstSheetName, lastSheetName, externalWorkbookNumber);
}
public Ptg[] getFormulaTokens(EvaluationCell cell) {
public ExternalSheet getExternalSheet(int externSheetIndex) {
throw new IllegalStateException("HSSF-style external references are not supported for XSSF");
}
- public ExternalSheet getExternalSheet(String sheetName, int externalWorkbookNumber) {
+ public ExternalSheet getExternalSheet(String firstSheetName, String lastSheetName, int externalWorkbookNumber) {
+ String workbookName;
if (externalWorkbookNumber > 0) {
// External reference - reference is 1 based, link table is 0 based
int linkNumber = externalWorkbookNumber - 1;
ExternalLinksTable linkTable = _uBook.getExternalLinksTable().get(linkNumber);
- return new ExternalSheet(linkTable.getLinkedFileName(), sheetName);
+ workbookName = linkTable.getLinkedFileName();
} else {
// Internal reference
- return new ExternalSheet(null, sheetName);
+ workbookName = null;
+ }
+
+ if (lastSheetName == null || firstSheetName.equals(lastSheetName)) {
+ return new ExternalSheet(workbookName, firstSheetName);
+ } else {
+ return new ExternalSheetRange(workbookName, firstSheetName, lastSheetName);
}
}