Esempio n. 1
0
 public void AppendText(string value, bool replaceInvalidWhiteSpace)
 {
     if (replaceInvalidWhiteSpace)
     {
         FormulaHandler.EncodeHeaderFooterString(m_valueBuilder, value);
     }
     else
     {
         m_valueBuilder.Append(value);
     }
 }
Esempio n. 2
0
 public IFont AppendTextRun(string value, bool replaceInvalidWhiteSpace)
 {
     if (m_valueBuilder.Length > 0)
     {
         m_stringBuilder.Append(m_valueBuilder.ToString());
         m_valueBuilder.Remove(0, m_valueBuilder.Length);
     }
     if (replaceInvalidWhiteSpace)
     {
         FormulaHandler.EncodeHeaderFooterString(m_valueBuilder, value);
     }
     else
     {
         m_valueBuilder.Append(value);
     }
     return(m_font);
 }
        public void BuildHeaderFooterString(StringBuilder str, RPLTextBoxProps textBox, ref string lastFont, ref double lastFontSize)
        {
            RPLElementStyle style = textBox.Style;
            string          text  = (string)style[20];

            if (!string.IsNullOrEmpty(text) && !text.Equals(lastFont))
            {
                str.Append("&").Append("\"");
                FormulaHandler.EncodeHeaderFooterString(str, text);
                str.Append("\"");
                lastFont = text;
            }
            string text2 = (string)style[21];

            if (!string.IsNullOrEmpty(text2))
            {
                double num = LayoutConvert.ToPoints(text2);
                if (num != 0.0 && num != lastFontSize)
                {
                    str.Append("&").Append((int)num);
                }
                lastFontSize = num;
            }
            StringBuilder stringBuilder = new StringBuilder();
            object        obj           = style[19];

            if (obj != null && (RPLFormat.FontStyles)obj == RPLFormat.FontStyles.Italic)
            {
                str.Append("&I");
                stringBuilder.Append("&I");
            }
            object obj2 = textBox.Style[22];

            if (obj2 != null && LayoutConvert.ToFontWeight((RPLFormat.FontWeights)obj2) >= 600)
            {
                str.Append("&B");
                stringBuilder.Append("&B");
            }
            object obj3 = textBox.Style[24];

            if (obj3 != null)
            {
                RPLFormat.TextDecorations num2 = (RPLFormat.TextDecorations)obj3;
                if (num2 == RPLFormat.TextDecorations.Underline)
                {
                    str.Append("&u");
                    stringBuilder.Append("&u");
                }
                if (num2 == RPLFormat.TextDecorations.LineThrough)
                {
                    str.Append("&s");
                    stringBuilder.Append("&s");
                }
            }
            string text3 = string.Empty;
            string text4 = ((RPLTextBoxPropsDef)textBox.Definition).Formula;

            if (text4 != null && text4.Length != 0)
            {
                if (text4.StartsWith("=", StringComparison.Ordinal))
                {
                    text4 = text4.Remove(0, 1);
                }
                text3 = FormulaHandler.ProcessHeaderFooterFormula(text4);
            }
            if (text3 != null && text3.Length != 0)
            {
                str.Append(text3);
            }
            else
            {
                string text5 = textBox.Value;
                if (text5 == null)
                {
                    text5 = ((RPLTextBoxPropsDef)textBox.Definition).Value;
                }
                if (text5 == null && textBox.OriginalValue != null)
                {
                    text5 = textBox.OriginalValue.ToString();
                }
                if (text5 != null)
                {
                    FormulaHandler.EncodeHeaderFooterString(str, text5.Trim());
                }
            }
            if (stringBuilder.Length > 0)
            {
                str.Append(stringBuilder);
            }
            str.Append(" ");
        }