使用itextsharp创建表格,设置表格单元格高度
PdfPTable table = new PdfPTable(dt.Columns.Count);
table.TotalWidth = 560;
table.LockedWidth = true;
table.SetWidths(new int[] {74,38,35,45,40,40,40,42,40});
for (int j = 0; j < dt.Columns.Count; j++)
{
table.AddCell(new Phrase(dt.Columns[j].HeaderText.ToString(), font));
}
table.HeaderRows = 1;
for (int i = 0; i < dt.Rows.Count; i++)
{
for (int j = 0; j < dt.Columns.Count; j++)
{
try
{
table.AddCell(new Phrase(dt[j, i].Value.ToString(), font));
}
catch (Exception e)
{
cc = true;
}
}
}
document.Add(table);