private static ValueEval EvaluateIndirect(OperationEvaluationContext ec, String text, bool isA1style) { int tmp = ec.RowIndex; tmp = ec.ColumnIndex; // Search backwards for '!' because sheet names can contain '!' int plingPos = text.LastIndexOf('!'); String workbookName; String sheetName; String refText; // whitespace around this Gets Trimmed OK if (plingPos < 0) { workbookName = null; sheetName = null; refText = text; } else { String[] parts = ParseWorkbookAndSheetName(text.Substring(0, plingPos)); if (parts == null) { return(ErrorEval.REF_INVALID); } workbookName = parts[0]; sheetName = parts[1]; refText = text.Substring(plingPos + 1); } String refStrPart1; String refStrPart2; if (Table.IsStructuredReference.Match(refText).Success) { // The argument is structured reference Area3DPxg areaPtg = null; try { areaPtg = FormulaParser.ParseStructuredReference(refText, (IFormulaParsingWorkbook)ec.GetWorkbook(), ec.RowIndex); } catch (FormulaParseException e) { return(ErrorEval.REF_INVALID); } return(ec.GetArea3DEval(areaPtg)); } else { // The argumnet is regular reference int colonPos = refText.IndexOf(':'); if (colonPos < 0) { refStrPart1 = refText.Trim(); refStrPart2 = null; } else { refStrPart1 = refText.Substring(0, colonPos).Trim(); refStrPart2 = refText.Substring(colonPos + 1).Trim(); } return(ec.GetDynamicReference(workbookName, sheetName, refStrPart1, refStrPart2, isA1style)); } }