Exemple #1
0
        /// <summary>
        /// Adds a <c>bodyPr</c> node (Body Properties) to the node of type <c>txPr</c> (Text properties) specified. Not supported in <c>EPPlus</c> library.
        /// </summary>
        /// <param name="textPropertiesNode"><c>txPr</c> node (Text properties).</param>
        /// <param name="orientation">A <see cref="KnownLabelOrientation" /> value from model.</param>
        /// <remarks>
        /// For more information please see <a href="http://www.schemacentral.com/sc/ooxml/e-a_bodyPr-2.html">http://www.schemacentral.com/sc/ooxml/e-a_bodyPr-2.html</a>
        /// </remarks>
        private static void AddBodyPropertiesNode(this XmlNode textPropertiesNode, KnownLabelOrientation orientation)
        {
            var rotAttr = ChartXmlHelper.CreateAttribute("rot");

            rotAttr.Value = orientation.ToAngle().ToString(CultureInfo.InvariantCulture);

            var vertAttr = ChartXmlHelper.CreateAttribute("vert");

            vertAttr.Value = orientation == KnownLabelOrientation.Vertical ? "wordArtVert" : "horz";

            var bodyPropertiesNode = ChartXmlHelper.CreateOrDefaultAndAppendElementToNode(textPropertiesNode, "a", "bodyPr");

            bodyPropertiesNode.Attributes.Append(rotAttr);
            bodyPropertiesNode.Attributes.Append(vertAttr);
        }
Exemple #2
0
        /// <summary>
        /// Converter for <see cref="T:iTin.Export.Model.KnownLabelOrientation"/> enumeration type to angle degree.
        /// </summary>
        /// <param name="orientation">Orientation style from model.</param>
        /// <returns>
        /// Orientation as angle in degrees.
        /// </returns>
        /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception>
        public static float ToAngle(this KnownLabelOrientation orientation)
        {
            SentinelHelper.IsEnumValid(orientation);

            switch (orientation)
            {
            case KnownLabelOrientation.Upward:
                return(-5400000);

            case KnownLabelOrientation.Downward:
                return(5400000);

            case KnownLabelOrientation.Vertical:
                return(0);

            case KnownLabelOrientation.Horizontal:
                return(0);

            default:
                return(0);
            }
        }