Hi,
I’ve run into an issue when a Shape(tried it on Oval and Rect) with specified height and width has a text box inside it with FitShapeToText set to true and the contents of the textbox stretch the shape. In this case the paragraph of the TextBox seems to end where it would if it had the specified height, but the shape is actually larger due to the contents of the TextBox stretching it. I’ve attached sample code that causes the issue. When I slightly resize the shape in the document or change the wrap text settings in word the document renders correctly.
var documentBuilder = new DocumentBuilder();
var shape = new Shape(documentBuilder.Document, ShapeType.Ellipse)
{
WrapType = WrapType.Inline,
TextBox = { FitShapeToText = true },
StrokeColor = Color.Black,
Height = 200,
Width = 100
};
var paragraph = new Paragraph(documentBuilder.Document);
var longText = new string('a', 300);
paragraph.AppendChild(new Run(documentBuilder.Document, longText));
shape.ChildNodes.Add(paragraph);
documentBuilder.InsertNode(shape);
var paragraphBelow =
new Paragraph(documentBuilder.Document).AppendChild(new Run(documentBuilder.Document, "Text below shape Text below shape Text below shape"));
documentBuilder.InsertNode(paragraphBelow);
documentBuilder.Document.Save(@"D:\ExampleOutput.docx");
Could you take a look?
Thank you,
Bartosz