Exemplo n.º 1
0
 private static OXmlAnchorWrapTight CreateAnchorWrapTight(BsonDocument element)
 {
     OXmlAnchorWrapTight wrapTight = new OXmlAnchorWrapTight();
     wrapTight.WrapText = element.zGet("WrapText").zAsString().zTryParseEnum(DW.WrapTextValues.BothSides);
     wrapTight.DistanceFromLeft = (uint)element.zGet("DistanceFromLeft").zAsInt();
     wrapTight.DistanceFromRight = (uint)element.zGet("DistanceFromRight").zAsInt();
     //wrapTight.WrapPolygon = OXmlDoc.CreateWrapPolygon(element.zGet("WrapPolygonHorizontalSize").zAsLong(), element.zGet("WrapPolygonVerticalSize").zAsLong(), element.zGet("WrapPolygonStartPointX").zAsLong(), element.zGet("WrapPolygonStartPointY").zAsLong());
     //wrapTight.WrapPolygon = new OXmlSquare
     //{
     //    StartPointX = element.zGet("WrapPolygonStartPointX").zAsLong(),
     //    StartPointY = element.zGet("WrapPolygonStartPointY").zAsLong(),
     //    HorizontalSize = element.zGet("WrapPolygonHorizontalSize").zAsLong(),
     //    VerticalSize = element.zGet("WrapPolygonVerticalSize").zAsLong()
     //};
     BsonDocument polygon = element.zGet("Polygon").zAsBsonDocument();
     if (polygon != null)
         wrapTight.WrapPolygon = CreatePolygon(polygon);
     else
     {
         polygon = element.zGet("Square").zAsBsonDocument();
         if (polygon != null)
             wrapTight.WrapPolygon = CreateSquare(polygon);
     }
     return wrapTight;
 }
Exemplo n.º 2
0
        //public void SetWrapTight(EnumValue<DW.WrapTextValues> wrapText, DW.WrapPolygon wrapPolygon, uint distanceFromLeft = 0, uint distanceFromRight = 0)
        private OpenXmlElement CreateWrapTight(OXmlAnchorWrapTight wrap)
        {
            // Tight Wrapping, <wp:wrapTight>
            DW.WrapTight wrapElement = new DW.WrapTight();

            // Text Wrapping Location, <wp:wrapTight 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.DistanceFromLeft != 0)
                // Distance From Text on Left Edge, <wp:wrapTight distL>
                wrapElement.DistanceFromLeft = wrap.DistanceFromLeft;
            if (wrap.DistanceFromRight != 0)
                // Distance From Text on Right Edge, <wp:wrapTight distR>
                wrapElement.DistanceFromRight = wrap.DistanceFromRight;

            // Tight Wrapping Extents Polygon, <wp:wrapPolygon>
            //wrapElement.WrapPolygon = wrapPolygon;
            //wrapElement.WrapPolygon = CreateSquareWrapPolygon(wrap.SquareSize);
            wrapElement.WrapPolygon = wrap.WrapPolygon.ToWrapPolygon();

            //_wrapElement = wrapElement;
            return wrapElement;
        }
 private static void SerializeWrapTight(BsonWriter bsonWriter, OXmlAnchorWrapTight wrap)
 {
     //if (wrap.WrapText != DW.WrapTextValues.BothSides)
     bsonWriter.WriteString("WrapText", wrap.WrapText.ToString());
     if (wrap.DistanceFromLeft != 0)
         bsonWriter.WriteInt32("DistanceFromLeft", (int)wrap.DistanceFromLeft);
     if (wrap.DistanceFromRight != 0)
         bsonWriter.WriteInt32("DistanceFromRight", (int)wrap.DistanceFromRight);
     SerializePolygonBase(bsonWriter, wrap.WrapPolygon);
 }