Dear Support,
- how to insert a Word TextBox
- can i insert HTML or Table into the TextBox?
thanks
Dear Support,
Please see the following code. I think that it could be useful for you.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert Textbox into the table
Shape textBox = new Shape(doc, ShapeType.TextBox);
Paragraph par = new Paragraph(doc);
Run run = new Run(doc, string.Empty);
par.AppendChild(run);
textBox.AppendChild(par);
doc.FirstSection.Body.FirstParagraph.AppendChild(textBox);
// Move cursor inside the textbox
builder.MoveTo(par);
// Insert table
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 5; j++)
{
builder.InsertCell();
}
builder.EndRow();
}
builder.EndTable();
doc.Save(@"Test046\out.doc");
Also note that best way to build table using Aspose.Words is using DocumentBuilder but not inserting HTML.
Best regards.
Hi
Thanks for your inquiry. Yes, of course this works. I think that you should just specify size of textbox:
// Insert Textbox into the table
Shape textBox = new Shape(doc, ShapeType.TextBox);
textBox.Width = 100;
textBox.Height = 100;
Hope this helps.
Best regards.