How to get and set image (shape) position using .NET

How can I set image anchor settings to “to character” like in the photo for inserted to document images (by default this have “as character”) ?

to_character_image_settings.png (40.1 KB)


Please note that Aspose.Words mimics the behavior of MS Word. You can set the position of shape according to your requirement using Aspose.Words. Please check the members of Shape class and examples.

Could you please ZIP and attach your expected output Word document and screenshot of shape property that you want to set using Aspose.Words? The shared image is not MS Word’s screenshot. Please also share some detail about it. We will then provide you more information about your query.


I’m sorry, could you clarify what you meant about “screenshot of shape property”?
Thank you. (1.6 MB)


The image is imported as Shape node into Aspose.Words’ DOM. With Aspose.Words, you can set or get the properties of shape node. In your shared document, the text wrapping is square. Please check the attached image. shape properties.png (40.0 KB)

Following code example shows how to get the shape position using Shape properties. You can use the same properties to set shape’s position.

var doc = new Document(MyDir + "Image.doc");
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 1, true);

Console.WriteLine("Text wrapping : "+ shape.WrapType);
Console.WriteLine("RelativeHorizontalPosition : " + shape.RelativeHorizontalPosition);
Console.WriteLine("RelativeVerticalPosition : " + shape.RelativeVerticalPosition);
Console.WriteLine("Left : " + shape.Left);
Console.WriteLine("Top : " + shape.Top);
1 Like


Yes, it works!
Thank you!