Ejemplo n.º 1
0
        //public void SetWrapSquare(EnumValue<DW.WrapTextValues> wrapText, uint distanceFromTop = 0, uint distanceFromBottom = 0, uint distanceFromLeft = 0, uint distanceFromRight = 0, DW.EffectExtent effectExtent = null)
        private OpenXmlElement CreateWrapSquare(OXmlAnchorWrapSquare wrap)
        {
            // <wp:wrapSquare wrapText="bothSides" distB="57150" distT="57150" distL="57150" distR="57150"/>
            // <wp:wrapSquare wrapText="bothSides"/>

            //Square Wrapping, <wp:wrapSquare>
            DW.WrapSquare wrapElement = new DW.WrapSquare();

            // Text Wrapping Location, <wp:wrapSquare wrapText>
            // BothSides - Both Sides ("bothSides"), Left - Left Side Only ("left"), Right - Right Side Only ("right"), Largest - Largest Side Only ("largest")
            //wrapElement.WrapText = wrapText;
            wrapElement.WrapText = wrap.WrapText;

            if (wrap.DistanceFromTop != null)
            {
                // Distance From Text (Top), <wp:wrapSquare distT>
                wrapElement.DistanceFromTop = (uint)wrap.DistanceFromTop;
            }
            if (wrap.DistanceFromBottom != null)
            {
                // Distance From Text on Bottom Edge, <wp:wrapSquare distB>
                wrapElement.DistanceFromBottom = (uint)wrap.DistanceFromBottom;
            }
            if (wrap.DistanceFromLeft != null)
            {
                // Distance From Text on Left Edge, <wp:wrapSquare distL>
                wrapElement.DistanceFromLeft = (uint)wrap.DistanceFromLeft;
            }
            if (wrap.DistanceFromRight != null)
            {
                // Distance From Text on Right Edge, <wp:wrapSquare distR>
                wrapElement.DistanceFromRight = (uint)wrap.DistanceFromRight;
            }

            if (wrap.EffectExtent != null)
            {
                // Object Extents Including Effects <wp:effectExtent>
                //   BottomEdge : Additional Extent on Bottom Edge (b)
                //   LeftEdge   : Additional Extent on Left Edge (l)
                //   RightEdge  : Additional Extent on Right Edge (r)
                //   TopEdge    : Additional Extent on Top Edge (t)
                // <wp:effectExtent b="0" l="0" r="0" t="0"/>
                wrapElement.EffectExtent = wrap.EffectExtent.ToEffectExtent();
            }

            //_wrapElement = wrapElement;
            return(wrapElement);
        }
Ejemplo n.º 2
0
        //public void SetWrapSquare(EnumValue<DW.WrapTextValues> wrapText, uint distanceFromTop = 0, uint distanceFromBottom = 0, uint distanceFromLeft = 0, uint distanceFromRight = 0, DW.EffectExtent effectExtent = null)
        private OpenXmlElement CreateWrapSquare(OXmlAnchorWrapSquare wrap)
        {
            // <wp:wrapSquare wrapText="bothSides" distB="57150" distT="57150" distL="57150" distR="57150"/>
            // <wp:wrapSquare wrapText="bothSides"/>

            //Square Wrapping, <wp:wrapSquare>
            DW.WrapSquare wrapElement = new DW.WrapSquare();

            // Text Wrapping Location, <wp:wrapSquare wrapText>
            // BothSides - Both Sides ("bothSides"), Left - Left Side Only ("left"), Right - Right Side Only ("right"), Largest - Largest Side Only ("largest")
            //wrapElement.WrapText = wrapText;
            wrapElement.WrapText = wrap.WrapText;

            if (wrap.DistanceFromTop != 0)
                // Distance From Text (Top), <wp:wrapSquare distT>
                wrapElement.DistanceFromTop = wrap.DistanceFromTop;
            if (wrap.DistanceFromBottom != 0)
                // Distance From Text on Bottom Edge, <wp:wrapSquare distB>
                wrapElement.DistanceFromBottom = wrap.DistanceFromBottom;
            if (wrap.DistanceFromLeft != 0)
                // Distance From Text on Left Edge, <wp:wrapSquare distL>
                wrapElement.DistanceFromLeft = wrap.DistanceFromLeft;
            if (wrap.DistanceFromRight != 0)
                // Distance From Text on Right Edge, <wp:wrapSquare distR>
                wrapElement.DistanceFromRight = wrap.DistanceFromRight;

            if (wrap.EffectExtent != null)
                // Object Extents Including Effects <wp:effectExtent>
                //   BottomEdge : Additional Extent on Bottom Edge (b)
                //   LeftEdge   : Additional Extent on Left Edge (l)
                //   RightEdge  : Additional Extent on Right Edge (r)
                //   TopEdge    : Additional Extent on Top Edge (t)
                // <wp:effectExtent b="0" l="0" r="0" t="0"/>
                wrapElement.EffectExtent = wrap.EffectExtent.ToEffectExtent();

            //_wrapElement = wrapElement;
            return wrapElement;
        }