We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to Add Text into a round rectangle Shape In c#

Please Guys,
I was able to create a round rectangle shape and add it to my word documents using aspose.words.shape. But I cant find a way to simply add a text into it.

Can somebody please help with that?
Here is my code

Shape roundRectangle = new Shape(Document, ShapeType.RoundRectangle);
roundRectangle.Width = cellFullWidth;
roundRectangle.TextBox.TextBoxWrapMode = TextBoxWrapMode.Square;
roundRectangle.IsLayoutInCell = true;
roundRectangle.FillColor = ColorTranslator.FromHtml("#F6F9FA");
roundRectangle.Height = 20;
roundRectangle.Stroked = false;

how to add text in the roundRectangle?

I was able to figure that out
Now how to change the font of the shape?
roundRectangle.Font.Name = “Arial”;
roundRectangle.Font.Size = 11;
the above code doesnt change anything.


Please ZIP and upload your current Aspose.Words generated document (.docx file) here for testing. We will investigate the issue on our end and provide you code to change the Font of the Shape.

there is no issue I was able to achieve all my goal. But I have another problem. I am using a rounded rectangle Shape to display text with a colored background and the bigger the text is the more the corner are rounded. Do you have a method to keep the same radius for the corner regardless the size of the content?
image.png (4.5 KB)
The image shows an example of what am talking about


Thanks for your inquiry. Please ZIP and attach your input and expected output Word documents here for our reference. We will then provide you more information about your query along with code example.