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

Free Support Forum - aspose.com

How to insert textbox to table

I need to insert textbox to table,Textbox contains different fonts and colors per line

ReferenceDoclet_withSingleCell.zip (22 Bytes)

@easyboot,

Thanks for your inquiry. Following code example shows how to insert textbox inside table’s cell. Hope this helps you.

Document document = new Document(MyDir + "in.docx");
                
Table table = document.FirstSection.Body.Tables[0];

Shape shape = new Shape(document, ShapeType.TextBox);                 
shape.Width = 100;
shape.Height = 50;
shape.WrapType = WrapType.Inline;

Paragraph paragraph = new Paragraph(document);
paragraph.AppendChild(new Run(document, "Text box inside table's cell"));
shape.AppendChild(paragraph);
                 
table.FirstRow.FirstCell.FirstParagraph.AppendChild(shape); 

document.Save(MyDir + "18.5.docx");