Reputation: 9738
I am using PdfPTable
to generate PDF's
and following is my relevant code
which loops through the data from db
.
The problem here is if there are 10 or more columns the PDF design gets horrible. Is there any way in iTextSharp
that Columns gets auto shifted in PDF by specifying Columns i require & rest columns are shifted on next page.
// Table Head
foreach (var q in tempColumnNames)
{
PdfPCell cell = new PdfPCell(new Phrase(q, fntTableFont));
table.AddCell(cell);
}
// Table Body
for (int i = 0; i < model.Count; i++)
{
for (int j = 0; j < model[i].Count(); j++)
{
PdfPCell cell = new PdfPCell(new Phrase(model[i][j].ToString(), fntTableFont));
table.AddCell(cell);
}
}
Upvotes: 1
Views: 509
Reputation: 1916
There's nothing automatic but you can use PdfPtable.WriteSelectedRows
to write only the required sections.
Upvotes: 1