public override TextRun this[int index] { get { if (index < 0 || index >= Count) { throw new ArgumentOutOfRangeException("index"); } TextRunImpl textRunImpl = m_textRuns[index]; if (textRunImpl == null) { Microsoft.ReportingServices.ReportIntermediateFormat.TextRun textRunDef = m_paragraphDef.TextRuns[index]; textRunImpl = new TextRunImpl(m_textBoxDef, textRunDef, m_reportRT, m_iErrorContext, m_scope); m_textRuns[index] = textRunImpl; } return(textRunImpl); } }
internal Microsoft.ReportingServices.RdlExpressions.VariantResult GetResult(IReportScopeInstance romInstance, bool calledFromValue) { if (calledFromValue && !IsTextboxInScope()) { m_result = default(Microsoft.ReportingServices.RdlExpressions.VariantResult); } else if (!m_isValueReady) { if (m_isVisited) { m_iErrorContext.Register(ProcessingErrorCode.rsCyclicExpression, Severity.Warning, m_textBox.ObjectType, m_textBox.Name, "Value"); throw new ReportProcessingException_InvalidOperationException(); } m_isVisited = true; _ = m_reportRT.ReportObjectModel; OnDemandProcessingContext odpContext = m_reportRT.ReportObjectModel.OdpContext; bool contextUpdated = m_reportRT.ContextUpdated; IInstancePath originalObject = null; m_reportRT.ContextUpdated = false; if (odpContext.IsTablixProcessingMode || calledFromValue) { originalObject = odpContext.LastRIFObject; } bool flag = m_textBox.Action != null && m_textBox.Action.TrackFieldsUsedInValueExpression; Dictionary <string, bool> dictionary = null; if (flag) { dictionary = new Dictionary <string, bool>(); } try { bool flag2 = false; if (m_paragraphs.Count == 1) { TextRunsImpl textRunsImpl = (TextRunsImpl)m_paragraphs[0].TextRuns; if (textRunsImpl.Count == 1) { flag2 = true; TextRunImpl textRunImpl = (TextRunImpl)textRunsImpl[0]; m_result = textRunImpl.GetResult(romInstance); if (flag) { textRunImpl.MergeFieldsUsedInValueExpression(dictionary); } } } if (!flag2) { bool flag3 = false; m_result = default(Microsoft.ReportingServices.RdlExpressions.VariantResult); StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < m_paragraphs.Count; i++) { if (i > 0) { flag3 = true; stringBuilder.Append(Environment.NewLine); } TextRunsImpl textRunsImpl2 = (TextRunsImpl)m_paragraphs[i].TextRuns; for (int j = 0; j < textRunsImpl2.Count; j++) { TextRunImpl textRunImpl2 = (TextRunImpl)textRunsImpl2[j]; Microsoft.ReportingServices.RdlExpressions.VariantResult result = textRunImpl2.GetResult(romInstance); if (result.Value != null) { if (result.TypeCode == TypeCode.Object && (result.Value is TimeSpan || result.Value is DateTimeOffset)) { string text = textRunImpl2.TextRunDef.FormatTextRunValue(result, odpContext); if (text != null) { result.Value = text; } else { result.Value = Microsoft.ReportingServices.RdlExpressions.ReportRuntime.ConvertToStringFallBack(result.Value); } } flag3 = true; stringBuilder.Append(result.Value); } if (flag) { textRunImpl2.MergeFieldsUsedInValueExpression(dictionary); } } } if (flag3) { m_result.Value = stringBuilder.ToString(); m_result.TypeCode = TypeCode.String; } } if (flag) { m_fieldsUsedInValueExpression = new List <string>(); foreach (string key in dictionary.Keys) { m_fieldsUsedInValueExpression.Add(key); } } } finally { odpContext.RestoreContext(originalObject); m_reportRT.ContextUpdated = contextUpdated; m_isVisited = false; m_isValueReady = true; } } return(m_result); }