ShapeBaseWrapSide Property |
Namespace: Aspose.Words.Drawing
The default value is Both.
Has effect only for top level shapes.
Document doc = new Document(MyDir + "Textboxes in drawing canvas.docx"); // This gets a live collection of all shape nodes in the document NodeCollection shapeCollection = doc.GetChildNodes(NodeType.Shape, true); // Since we will be adding/removing nodes, it is better to copy all collection // into a fixed size array, otherwise iterator will be invalidated Node[] shapes = shapeCollection.ToArray(); foreach (Shape shape in shapes.OfType<Shape>()) { // Filter out all shapes that we don't need if (shape.ShapeType.Equals(ShapeType.TextBox)) { // Create a new shape that will replace the existing shape Shape image = new Shape(doc, ShapeType.Image); // Load the image into the new shape image.ImageData.SetImage(ImageDir + "Windows MetaFile.wmf"); // Make new shape's position to match the old shape image.Left = shape.Left; image.Top = shape.Top; image.Width = shape.Width; image.Height = shape.Height; image.RelativeHorizontalPosition = shape.RelativeHorizontalPosition; image.RelativeVerticalPosition = shape.RelativeVerticalPosition; image.HorizontalAlignment = shape.HorizontalAlignment; image.VerticalAlignment = shape.VerticalAlignment; image.WrapType = shape.WrapType; image.WrapSide = shape.WrapSide; // Insert new shape after the old shape and remove the old shape shape.ParentNode.InsertAfter(image, shape); shape.Remove(); } } doc.Save(ArtifactsDir + "Shape.ReplaceTextboxesWithImages.doc");