コード例 #1
0
 private void EvaluateOriginalValue()
 {
     if (m_originalValueEvaluated)
     {
         return;
     }
     m_originalValueEvaluated = true;
     Microsoft.ReportingServices.ReportIntermediateFormat.TextBox texBoxDef = m_textBoxDef.TexBoxDef;
     if (texBoxDef.HasValue)
     {
         _ = base.RenderingContext.OdpContext;
         m_originalValue = default(VariantResult);
         if (texBoxDef.IsSimple)
         {
             InternalTextRunInstance internalTextRunInstance = (InternalTextRunInstance)m_textBoxDef.Paragraphs[0].TextRuns[0].Instance;
             m_originalValue.Value         = internalTextRunInstance.OriginalValue;
             m_originalValue.ErrorOccurred = internalTextRunInstance.ProcessedWithError;
             m_typeCode = internalTextRunInstance.TypeCode;
             m_originalValue.TypeCode = m_typeCode.Value;
             return;
         }
         StringBuilder stringBuilder = new StringBuilder();
         bool          flag          = false;
         bool          flag2         = true;
         foreach (ParagraphInstance paragraphInstance in ParagraphInstances)
         {
             if (!flag2)
             {
                 flag = true;
                 stringBuilder.Append(Environment.NewLine);
             }
             else
             {
                 flag2 = false;
             }
             foreach (TextRunInstance textRunInstance in paragraphInstance.TextRunInstances)
             {
                 object originalValue = textRunInstance.OriginalValue;
                 if (originalValue != null)
                 {
                     flag = true;
                     stringBuilder.Append(originalValue);
                 }
             }
         }
         if (flag)
         {
             m_originalValue.Value    = stringBuilder.ToString();
             m_originalValue.TypeCode = TypeCode.String;
             m_typeCode = TypeCode.String;
         }
     }
     else
     {
         m_typeCode = TypeCode.Empty;
     }
 }
コード例 #2
0
 private void Parse()
 {
     if (m_parsed)
     {
         return;
     }
     try
     {
         m_parsed = true;
         m_paragraphDef.CriGenerationPhase = ReportElement.CriGenerationPhases.Definition;
         m_textRunDef.CriGenerationPhase   = ReportElement.CriGenerationPhases.Definition;
         ReportEnumProperty <MarkupType> markupType = m_textRunDef.MarkupType;
         MarkupType     markupType2    = (!markupType.IsExpression) ? markupType.Value : m_textRunDef.Instance.MarkupType;
         RichTextParser richTextParser = null;
         if (markupType2 != MarkupType.HTML)
         {
             return;
         }
         richTextParser = new HtmlParser(m_multipleParagraphsAllowed, this, this);
         InternalTextRunInstance internalTextRunInstance = (InternalTextRunInstance)m_textRunDef.Instance;
         Microsoft.ReportingServices.RdlExpressions.VariantResult originalValue = internalTextRunInstance.GetOriginalValue();
         if (!originalValue.ErrorOccurred && originalValue.TypeCode != 0)
         {
             try
             {
                 string richText = (originalValue.TypeCode != TypeCode.String) ? internalTextRunInstance.TextRunDef.FormatTextRunValue(originalValue.Value, originalValue.TypeCode, m_textRunDef.RenderingContext.OdpContext) : (originalValue.Value as string);
                 m_compiledParagraphCollection = (CompiledParagraphInstanceCollection)richTextParser.Parse(richText);
             }
             catch (Exception ex)
             {
                 m_errorContext.Register(ProcessingErrorCode.rsInvalidRichTextParseFailed, Severity.Warning, "TextRun", internalTextRunInstance.TextRunDef.Name, ex.Message);
                 m_parseErrorOccured         = true;
                 CreateSingleTextRun().Value = RPRes.rsRichTextParseErrorValue;
             }
         }
         else
         {
             ICompiledTextRunInstance compiledTextRunInstance = CreateSingleTextRun();
             if (originalValue.ErrorOccurred)
             {
                 compiledTextRunInstance.Value = RPRes.rsExpressionErrorValue;
             }
         }
     }
     finally
     {
         m_textRunDef.CriGenerationPhase   = ReportElement.CriGenerationPhases.None;
         m_paragraphDef.CriGenerationPhase = ReportElement.CriGenerationPhases.None;
     }
 }