Thanks for your inquiry. Yes you can create PDF with a Table and can populate Table object with data from any data source using Aspose.Pdf for .NET. Please check a sample code snippet as following for the purpose. Hopefully it will help you to accomplish the requirements.
string outFile = myDir + “DynamicTable.pdf”;<o:p></o:p>
DataTable dt = new
DataTable("Questions");
dt.Columns.Add("Question_Number",
typeof(Int32));
dt.Columns.Add("Comments",
typeof(string));
//Add 2 rows into the DataTable object
programmatically
DataRow dr = dt.NewRow();
dr[0] =1;
dr[1] = "Comments
of 1st question";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = 2;
dr[1] = "Comments
of 2nd question";
dt.Rows.Add(dr);
// Load source PDF document
Document doc = new
Document();
doc.Pages.Add();
// Initializes a new instance of the
Table
Aspose.Pdf.Table
table = new Aspose.Pdf.Table();
//Set column widths of the table
table.ColumnWidths = "100
300";
// Set the table border color as
LightGray
table.Border = new
Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray));
// set the border for table cells
table.DefaultCellBorder = new
Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray));
table.ImportDataTable(dt, true,
0, 0,3,3);
// Add table object to first page of
input document
doc.Pages[1].Paragraphs.Add(table);
// Save updated document containing
table object
doc.Save(outFile);
Please feel free to contact us for any further assistance.
Best Regards,