Good Day
Hi Pieter,
Document doc = new
Document();<o:p></o:p>
Aspose.Pdf.Page page = doc.Pages.Add();
Aspose.Pdf.Table table1 = new Aspose.Pdf.Table();
table1.ColumnWidths = "120 120 120";
page.Paragraphs.Add(table1);
Aspose.Pdf.Row row1 = table1.Rows.Add();
row1.FixedRowHeight = 15;
Aspose.Pdf.Cell cell1 = row1.Cells.Add("Name");
Aspose.Pdf.Cell cell2 = row1.Cells.Add("City");
Aspose.Pdf.Cell cell3 = row1.Cells.Add("State");
TextBoxField field = new TextBoxField();
field.PartialName = "TextBoxName";
field.Value = "John";
field.Width = 120;
field.Height = 15;
field.Multiline = true;
TextBoxField field2 = new TextBoxField();
field2.PartialName = "TextBoxCity";
field2.Value = "New York";
field2.Width = 120;
field2.Height = 15;
TextBoxField field3 = new TextBoxField();
field3.PartialName = "TextBoxState";
field3.Value = "NY";
field3.Width = 120;
field3.Height = 15;
Aspose.Pdf.Row row2 = table1.Rows.Add();
Aspose.Pdf.Cell cell4 = row2.Cells.Add();
Aspose.Pdf.Cell cell5 = row2.Cells.Add();
Aspose.Pdf.Cell cell6 = row2.Cells.Add();
cell4.Paragraphs.Add(field);
cell5.Paragraphs.Add(field2);
cell6.Paragraphs.Add(field3);
Aspose.Pdf.Row row3 = table1.Rows.Add();
row3.FixedRowHeight = 80;
//Aspose.Pdf.Cell commentTbCell = row3.Cells.Add();
Aspose.Pdf.Cell commentTbCell = new Aspose.Pdf.Cell();
commentTbCell.ColSpan = 3;
TextBoxField textBoxField11 = new TextBoxField();
textBoxField11.PartialName = "Comment_tb";
textBoxField11.Height = 70;
textBoxField11.Multiline = true;
textBoxField11.Width = 360;
commentTbCell.Paragraphs.Add(textBoxField11);
row3.Cells.Add(commentTbCell);
//Save modified PDF
doc.Save(myDir + "PDFFormOutput.pdf");
Please feel free to contact us for any further assistance.
Best Regards,
Thanks for your response. Greatly appreciated.
Hi Pieter,
Hello,
what if i dont know the height of the table row in which i want to add the Textboxfield, because content is written dynamically in that row, for example in a preceding cell? The Textbox size should be the same size then. How can i do that?
Thanks for contacting support.
You may add TextboxField without specifying height and width and it will be added with default dimensions. However, in case you are facing any issue while achieving your requirement, please share complete sample code snippet along with sample PDF document. We will test the scenario in our environment and share our feedback accordingly.