Click here to Skip to main content
15,886,199 members
Articles / Programming Languages / C#

RTF Document Constructor Library

Rate me:
Please Sign up or sign in to vote.
4.95/5 (57 votes)
16 Aug 2010CPOL4 min read 213.3K   5.2K   106  
Create Rich Text Format documents programatically.
using System;
using System.Collections.Generic;
using System.Text;

namespace ESCommon.Rtf
{
    /// <summary>
    /// Represents table cell borders.
    /// </summary>
    public class RtfTableCellBorders
    {
        private RtfBorder
            top = new RtfBorder(),
            left = new RtfBorder(),
            bottom = new RtfBorder(),
            right = new RtfBorder();
        
        /// <summary>
        /// Gets the top border of the cell.
        /// </summary>
        [RtfControlWord("clbrdrt"), RtfInclude(ConditionMember = "IsTopBorderSet")]
        public RtfBorder Top
        {
            get { return top; }
        }

        /// <summary>
        /// Gets the left border of the cell.
        /// </summary>
        [RtfControlWord("clbrdrl"), RtfInclude(ConditionMember = "IsLeftBorderSet")]
        public RtfBorder Left
        {
            get { return left; }
        }

        /// <summary>
        /// Gets the bottom border of the cell.
        /// </summary>
        [RtfControlWord("clbrdrb"), RtfInclude(ConditionMember = "IsBottomBorderSet")]
        public RtfBorder Bottom
        {
            get { return bottom; }
        }

        /// <summary>
        /// Gets the right border of the cell.
        /// </summary>
        [RtfControlWord("clbrdrr"), RtfInclude(ConditionMember = "IsRightBorderSet")]
        public RtfBorder Right
        {
            get { return right; }
        }

        /// <summary>
        /// Gets a Boolean value indicating whether top border of the cell is set. This property is used by RtfWriter.
        /// </summary>
        public bool IsTopBorderSet
        {
            get { return Top.Width > 0; }
        }

        /// <summary>
        /// Gets a Boolean value indicating whether left border of the cell is set. This property is used by RtfWriter.
        /// </summary>
        public bool IsLeftBorderSet
        {
            get { return Left.Width > 0; }
        }

        /// <summary>
        /// Gets a Boolean value indicating whether bottom border of the cell is set. This property is used by RtfWriter.
        /// </summary>
        public bool IsBottomBorderSet
        {
            get { return Bottom.Width > 0; }
        }

        /// <summary>
        /// Gets a Boolean value indicating whether right border of the cell is set. This property is used by RtfWriter.
        /// </summary>
        public bool IsRightBorderSet
        {
            get { return Right.Width > 0; }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Energoservice
Russian Federation Russian Federation
Dmitry lives in Arkhangelsk, Russia. He has developed C# applications since 2007.

Comments and Discussions