Textbox.FitShapeToText causing texbox to be tall but not wide

Hi there, I have some code that looks like this, and is working well for the most part inserting a textbox into a pre-existing word document.

the problematic part is something like:

//declare doc
//declare paragraph
Shape shape = new Shape(doc, ShapeType.TextBox);

ar run = new Aspose.Words.Run(doc, text);
run.Font.Name = “Arial”;
paragraph.AppendChild(run);
shape.AppendChild(paragraph);
shape.TextBox.FitShapeToText = true;
doc.FirstSection.Body.FirstParagraph.AppendChild(shape);
//save document

and the text gets inserted where i want but instead of the textbox expanding horizontally with the text size, it expands vertically, so if the text is “hello” it looks like this:

h
e
l
l
o

instead of

hello

What am I doing wrong? Is that how FitShapeToText is expected to work?

@blumbard,

Please specify Shape’s height and width:

Shape shape = new Shape(doc, ShapeType.TextBox);

Run run = new Aspose.Words.Run(doc, "Hello");
run.Font.Name = "Arial";
Paragraph paragraph = new Paragraph(doc);
paragraph.AppendChild(run);

shape.Width = 3 * 72; // 3 inches
shape.Height = 1 * 72; // 1 inches

shape.AppendChild(paragraph);
shape.TextBox.FitShapeToText = true;
doc.LastSection.Body.LastParagraph.AppendChild(shape);