2oppin
2oppin

Reputation: 1991

How to make picture circled?

I need to make picture in Word document circled. I adding to doc it like that:

Shape pic = wordDoc.Shapes.AddPicture(imageFile, ref missing, ref missing, 50, 0, 125, 125);

When you right click on image in Word2016, you can select one of presets, like rounded rectangle, dimond or something other. I understand that thats presets that consists of bunch of properties, yet was not able to find in Word2016 how to select only shape form, maybe it would give a hint on how to solve issue.

Tried:

 pic.ShapeStyle = Microsoft.Office.Core.MsoShapeStyleIndex.msoShapeStylePreset2;

But seems it have no effect at all, and even if I find some preset, this solution seems not reliable (sure that on different workstations presets may be different)

Upvotes: 1

Views: 163

Answers (2)

2oppin
2oppin

Reputation: 1991

Thanks to @m4o_tim, I was able to solve problem, went with 1st suggestion:

Use a Picture fill - add a shape with an AutoShapeType of msoOval and then set the Fill.UserPicture property to the image file you want to use

So solution is:

Shape shp = wordDoc.Shapes.AddShape((int) MsoAutoShapeType.msoShapeOval, 80, 40, 125, 125);
shp.Fill.UserPicture(imageFileNamePath);

Upvotes: 0

Timothy Rylatt
Timothy Rylatt

Reputation: 7850

There are two ways to do this in Word.

  1. Use a Picture fill - add a shape with an AutoShapeType of msoOval and then set the Fill.UserPicture property to the image file you want to use.
  2. Crop a picture to a shape - add a picture and then change the AutoShapeType to msoShapeOval.

Upvotes: 2

Related Questions