Exemplo n.º 1
0
        /// <summary>
        /// 添加加红信息
        /// </summary>
        /// <param name="rtf"></param>
        /// <param name="str"></param>
        /// <param name="ss"></param>
        /// <returns></returns>
        public static Rtf AddRtf(this Rtf rtf, string str, params object[] ss)
        {
            var sss = str.Split("@");

            sss.ForEachT(s =>
            {
                var v = s.RegexGetString(@"@(\d*)");
                if (int.TryParse(v, out int key))
                {
                    string v1 = s;
                    if (key >= 0)
                    {
                        if (ss.Length > key)
                        {
                            switch (ss[key])
                            {
                            case Rtf r:
                                rtf.AddRtf(r);
                                break;

                            default:
                                rtf.AddColorText(ss[key].ToString(), Rtf.RtfColor.Red, 18);
                                break;
                            }
                            v1 = s.Substring(("@" + key).Length);
                        }
                    }
                    rtf.AddColorText(v1, 0);
                }
                else
                {
                    rtf.AddColorText(s, 0);
                }
            });
            return(rtf);
        }
Exemplo n.º 2
0
Arquivo: Rtf.cs Projeto: oujunke/Help
 public Rtf AddRtf(Rtf rh)
 {
     RTFData += rh.RTFData;
     Text    += rh.Text;
     return(this);
 }