Описание тега pdfptable
Класс таблицы, используемый iTextPdf (iText и iTextSharp) версий 5.x для создания таблиц
PdfPTable
- класс для создания таблиц в itext (Java) и itextsharp (.Net).
Это очень простой пример его использования:
/**
* Example written by Bruno Lowagie and Nishanthi Grashia in answer to the following question:
* https://stackru.com/questions/24359321/adding-row-to-a-table-in-pdf-using-itext
*/
@WrapToTest
public class SimpleTable
{
public static final String DEST = "results/tables/simple_table.pdf";
public static void main(String[] args) throws IOException, DocumentException
{
File file = new File(DEST);
file.getParentFile().mkdirs();
new SimpleTable().createPdf(DEST);
}
public void createPdf(String dest) throws IOException, DocumentException
{
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(dest));
document.open();
PdfPTable table = new PdfPTable(8);
for(int aw = 0; aw < 16; aw++)
{
table.addCell("hi");
}
document.add(table);
document.close();
}
}
( 101 - очень простая таблица)
Еще много примеров, иллюстрирующих, как создавать более сложные таблицы, можно найти в разделе примеров на сайте itextpdf.com.