コード例 #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());
        }