Beispiel #1
0
        public override string render()
        {
            LinkedList <Token> tokList = buildTokenList();
            StringBuilder      result  = new StringBuilder(_blockHead);

            if (_startNewPage)
            {
                result.Append(@"\pagebb");
            }

            if (_linespacing >= 0)
            {
                result.Append(@"\sl-" + RtfUtility.pt2Twip(_linespacing) + @"\slmult0");
            }
            if (_margins[Direction.Top] > 0)
            {
                result.Append(@"\sb" + RtfUtility.pt2Twip(_margins[Direction.Top]));
            }
            if (_margins[Direction.Bottom] > 0)
            {
                result.Append(@"\sa" + RtfUtility.pt2Twip(_margins[Direction.Bottom]));
            }
            if (_margins[Direction.Left] > 0)
            {
                result.Append(@"\li" + RtfUtility.pt2Twip(_margins[Direction.Left]));
            }
            if (_margins[Direction.Right] > 0)
            {
                result.Append(@"\ri" + RtfUtility.pt2Twip(_margins[Direction.Right]));
            }
            //if (_firstLineIndent != 0) {
            result.Append(@"\fi" + RtfUtility.pt2Twip(_firstLineIndent));
            //}
            result.Append(AlignmentCode());
            result.AppendLine();

            // insert default char format intto the 1st position of _charFormats
            if (_defaultCharFormat != null)
            {
                result.AppendLine(_defaultCharFormat.renderHead());
            }
            result.AppendLine(extractTokenList(tokList));
            if (_defaultCharFormat != null)
            {
                result.Append(_defaultCharFormat.renderTail());
            }

            result.AppendLine(_blockTail);
            return(result.ToString());
        }
Beispiel #2
0
        internal override string render()
        {
            LinkedList <Token> tokList = buildTokenList();
            StringBuilder      result  = new StringBuilder(_blockHead);

            if (_startNewPage)
            {
                result.Append(@"\pagebb");
            }

            if (_linespacing > 0)
            {
                result.Append(@"\sl-" + RtfUtility.pt2Twip(_linespacing) + @"\slmult0");
            }
            if (_margins[Direction.Top] >= 0)
            {
                result.Append(@"\sb" + RtfUtility.pt2Twip(_margins[Direction.Top]));
            }
            if (_margins[Direction.Bottom] >= 0)
            {
                result.Append(@"\sa" + RtfUtility.pt2Twip(_margins[Direction.Bottom]));
            }
            if (_margins[Direction.Left] >= 0)
            {
                result.Append(@"\li" + RtfUtility.pt2Twip(_margins[Direction.Left]));
            }
            if (_margins[Direction.Right] >= 0)
            {
                result.Append(@"\ri" + RtfUtility.pt2Twip(_margins[Direction.Right]));
            }
            //if (_firstLineIndent != 0) {
            result.Append(@"\fi" + RtfUtility.pt2Twip(_firstLineIndent));
            //}
            switch (_align)
            {
            case Align.Left:
                result.Append(@"\ql");
                break;

            case Align.Right:
                result.Append(@"\qr");
                break;

            case Align.Center:
                result.Append(@"\qc");
                break;

            case Align.FullyJustify:
                result.Append(@"\qj");
                break;

            case Align.Distributed:
                result.Append(@"\qd");
                break;
            }
            result.AppendLine();

            // insert default char format intto the 1st position of _charFormats
            if (_defaultCharFormat != null)
            {
                result.AppendLine(_defaultCharFormat.renderHead());
            }
            result.AppendLine(extractTokenList(tokList));
            if (_defaultCharFormat != null)
            {
                result.Append(_defaultCharFormat.renderTail());
            }

            result.AppendLine(_blockTail);
            return(result.ToString());
        }