Вопрос

I need to render each cell values in a new page.

I am using the following code :

List<string> values = getValues(); // getValues() method returns a list of strings
Document doc = new Document();
....
PdfPTable table = new PdfPTable(1);
foreach(var s in values)
{
    table.AddCell(s);
    doc.NewPage();
}
...

But I am getting the output in a single page.

Это было полезно?

Решение

Add a one-cell table on each page:

List<string> values = getValues(); // getValues() method returns a list of strings
Document doc = new Document();
....
foreach(var s in values)
{
    PdfPTable table = new PdfPTable(1);
    table.AddCell(s);
    doc.add(table);
    doc.NewPage();
}
...
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top