Hi, so trying to render a PDF that includes a Table.
Here is the Header of the Table, no issue with this:
Code:
// def header of table
MigraDoc.DocumentObjectModel.Tables.Row row = table.AddRow();
MigraDoc.DocumentObjectModel.Tables.Cell cell = row.Cells[0];
cell.AddParagraph("Jurisdictions");
cell.Format.Font.Bold = true;
cell = row.Cells[1];
cell.AddParagraph("Approval#");
cell.Format.Font.Bold = true;
cell = row.Cells[2];
cell.AddParagraph("Notes");
cell.Format.Font.Bold = true;
cell = row.Cells[3];
cell.AddParagraph("Jurisdiction Fee");
cell.Format.Font.Bold = true;
cell = row.Cells[4];
cell.AddParagraph("Permit Now Fee");
cell.Format.Font.Bold = true;
The problem is when I try and insert (from a database the values stored therein).
Here is the code loading the data and attempting to display it:
Code:
connection = new MySqlConnection(connetionString);
connection.Open();
command = new MySqlCommand(sql, connection);
adapter.SelectCommand = command;
// adapter.Fill(ds);
adapter.Fill(dt);
connection.Close();
foreach(DataRow newrow in dt.Rows)
{
row.Table.AddRow();
cell = row.Cells[0];
cell.AddParagraph(newrow["ApprovalJurisdiction"].ToString());
cell = row.Cells[1];
cell.AddParagraph(newrow["ApprovalAppNumber"].ToString());
cell = row.Cells[2];
cell.AddParagraph(newrow["ApprovalNotes"].ToString());
cell = row.Cells[3];
cell.AddParagraph(newrow["ApprovalJurisdictionFee"].ToString());
cell = row.Cells[4];
cell.AddParagraph(newrow["ApprovalPermitNowFee"].ToString());
}
I've attached a copy of the output.
It literally puts everything in the right column, but all in the header.
I had a FOR loop populating this table, but someone said use a FOR EACH loop, but the output is the same.
Any assistance would be appreciated!
G