Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

RTF Document Constructor Library

, 16 Aug 2010
Create Rich Text Format documents programatically.
using System;
using System.Collections.Generic;
using System.Text;

namespace ESCommon.Rtf
{
    /// <summary>
    /// Defines units used to specify padding.
    /// </summary>
    [RtfEnumAsControlWord(RtfEnumConversion.UseValue)]
    public enum RtfPaddingUnits
    {
        /// <summary>
        /// The reader should ignore padding.
        /// </summary>
        Null = 0,
        /// <summary>
        /// The padding is set in twips.
        /// </summary>
        Twips = 3
    }

    /// <summary>
    /// Represents table row padding.
    /// </summary>
    public class RtfTableRowPadding
    {
        private RtfPaddingUnits leftUnits = RtfPaddingUnits.Twips;
        private RtfPaddingUnits topUnits = RtfPaddingUnits.Twips;
        private RtfPaddingUnits bottomUnits = RtfPaddingUnits.Twips;
        private RtfPaddingUnits rightUnits = RtfPaddingUnits.Twips;


        [RtfControlWord("trspdl"), RtfInclude(ConditionMember = "IsLeftPaddingSet")]
        public int Left { get; set; }

        [RtfControlWord("trspdt"), RtfInclude(ConditionMember = "IsTopPaddingSet")]
        public int Top { get; set; }

        [RtfControlWord("trspdb"), RtfInclude(ConditionMember = "IsBottomPaddingSet")]
        public int Bottom { get; set; }

        [RtfControlWord("trspdr"), RtfInclude(ConditionMember = "IsRightPaddingSet")]
        public int Right { get; set; }


        [RtfControlWord("trspdrfl"), RtfInclude(ConditionMember = "IsLeftPaddingSet")]
        public RtfPaddingUnits LeftUnits
        {
            get { return leftUnits; }
            set { leftUnits = value; }
        }

        [RtfControlWord("trspdrft"), RtfInclude(ConditionMember = "IsTopPaddingSet")]
        public RtfPaddingUnits TopUnits
        {
            get { return topUnits; }
            set { topUnits = value; }
        }

        [RtfControlWord("trspdrfb"), RtfInclude(ConditionMember = "IsBottomPaddingSet")]
        public RtfPaddingUnits BottomUnits
        {
            get { return bottomUnits; }
            set { bottomUnits = value; }
        }

        [RtfControlWord("trspdrfr"), RtfInclude(ConditionMember = "IsRightPaddingSet")]
        public RtfPaddingUnits RightUnits
        {
            get { return rightUnits; }
            set { rightUnits = value; }
        }


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

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

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

        /// <summary>
        /// Gets a Boolean value indicating whether right padding of the row is set. This property is used by RtfWriter.
        /// </summary>
        public bool IsRightPaddingSet
        {
            get { return Right > 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)

Share

About the Author

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

| Advertise | Privacy | Mobile
Web02 | 2.8.140926.1 | Last Updated 16 Aug 2010
Article Copyright 2010 by Dima Popov
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid