Пример #1
0
        public override string ToRtf(RtfContext context)
        {
            if (BackColor == null)
            {
                return(DecoratedTextBlock.ToRtf(context));
            }
            var cnumber = context.AddColor(BackColor);

            return($@"\highlight{cnumber} {DecoratedTextBlock.ToRtf(context)}");
        }
Пример #2
0
        public override string ToRtf(RtfContext context)
        {
            if (Font == null)
            {
                return(DecoratedTextBlock.ToRtf(context));
            }
            var strikeThroughCmd = Font.Strikeout ? "strike" : "strike0";
            var twips            = Math.Floor(Font.SizeInPoints * 2);
            var fnumber          = context.AddFont(Font.Name);

            return($@"\f{fnumber}\fs{twips}\{strikeThroughCmd} {DecoratedTextBlock.ToRtf(context)}");
        }
Пример #3
0
        public override string ToRtf(RtfContext context)
        {
            var underlineCmd = "ul";

            switch (Underline)
            {
            case UnderlineType.None:
                underlineCmd = "ulnone";
                break;

            case UnderlineType.Single:
                underlineCmd = "ul";
                break;

            case UnderlineType.Double:
                underlineCmd = "uldb";
                break;
            }
            return($@"\{underlineCmd} {DecoratedTextBlock.ToRtf(context)}");
        }
Пример #4
0
        public override string ToRtf(RtfContext context)
        {
            var text  = DecoratedTextBlock.RawText;
            var match = numericListRegex.Match(text);

            if (match.Success)
            {
                context.ListStyle         = match.Groups[2].Value;
                context.LastListNumbering = match.Groups[1].Value;
                return(DecoratedTextBlock.ToRtf(context));
            }
            var lastNumbering = context.LastListNumbering ?? "0";
            var sections      = lastNumbering.Split('.').Select(d => int.Parse(d)).ToList();

            sections[sections.Count - 1]++;
            var numbering = String.Join(".", sections);

            context.LastListNumbering = numbering;
            context.ListStyle         = context.ListStyle ?? ".";
            return($@"{numbering}{context.ListStyle}{DecoratedTextBlock.ToRtf(context)}");
        }
Пример #5
0
 public override string ToRtf(RtfContext context)
 {
     return($@"\b {DecoratedTextBlock.ToRtf(context)}");
 }
Пример #6
0
        public override string ToRtf(RtfContext context)
        {
            var cmd = (Indent == IndentType.Left ? "li" : "ri");

            return($@"\{cmd}720 {DecoratedTextBlock.ToRtf(context)}");
        }