public String resolveNameXText(int refIndex, int definedNameIndex, InternalWorkbook workbook) {int extBookIndex = _externSheetRecord.getExtbookIndexFromRefIndex(refIndex);int firstTabIndex = _externSheetRecord.getFirstSheetIndexFromRefIndex(refIndex);if (firstTabIndex == -1) {throw new RuntimeException("Referenced sheet could not be found");}ExternalBookBlock externalBook = _externalBookBlocks[extBookIndex];if (externalBook._externalNameRecords.length > definedNameIndex) {return _externalBookBlocks[extBookIndex].getNameText(definedNameIndex);} else if (firstTabIndex == -2) {NameRecord nr = getNameRecord(definedNameIndex);int sheetNumber = nr.getSheetNumber();StringBuilder text = new StringBuilder(64);if (sheetNumber > 0) {String sheetName = workbook.getSheetName(sheetNumber - 1);SheetNameFormatter.appendFormat(text, sheetName);text.append("!");}text.append(nr.getNameText());return text.toString();} else {throw new ArrayIndexOutOfBoundsException("Ext Book Index relative but beyond the supported length, was " +extBookIndex + " but maximum is " + _externalBookBlocks.length);}}

public String ResolveNameXText(int refIndex, int definedNameIndex, InternalWorkbook workbook){int extBookIndex = _externSheetRecord.GetExtbookIndexFromRefIndex(refIndex);int firstTabIndex = _externSheetRecord.GetFirstSheetIndexFromRefIndex(refIndex);if (firstTabIndex == -1){throw new RuntimeException("Referenced sheet could not be found");}ExternalBookBlock externalBook = _externalBookBlocks[extBookIndex];if (externalBook._externalNameRecords.Length > definedNameIndex){return _externalBookBlocks[extBookIndex].GetNameText(definedNameIndex);}else if (firstTabIndex == -2){NameRecord nr = GetNameRecord(definedNameIndex);int sheetNumber = nr.SheetNumber;StringBuilder text = new StringBuilder();if (sheetNumber > 0){String sheetName = workbook.GetSheetName(sheetNumber - 1);SheetNameFormatter.AppendFormat(text, sheetName);text.Append("!");}text.Append(nr.NameText);return text.ToString();}else{throw new IndexOutOfRangeException("Ext Book Index relative but beyond the supported length, was " +extBookIndex + " but maximum is " + _externalBookBlocks.Length);}}
