Free Support Forum - aspose.com

Auto sizing a textbox to the size of inserted text

Is there a way to have a textbox auto size to the size of the inserted text?

@paul.calhoun,

Thanks for your inquiry. Please use Shape.TextBox.FitShapeToText to determines whether Microsoft Word will grow the shape to fit text.

Document doc = new Document(MyDir + "in.docx");
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
shape.TextBox.FitShapeToText = true; 
doc.Save(MyDir + "18.4.docx");