java - itext pdf doesn't show table when setHeaderRows -


i created table n columns header using setheaderrows(n), when add table n-1 records , deploy, nothing displayed, i.e. if create table has 5 columns header , add 4 records or less table, nothing displayed.

sample code

document document = new document(new rectangle(605, 784), 28, 28, 42, 28); pdfwriter writer = pdfwriter.getinstance(document, new   fileoutputstream("/temp/tabla.pdf")); documento.open(); // create table pdfptable tabla = new pdfptable(5); tabla.setcomplete(false); tabla.setwidthpercentage(100); tabla.getdefaultcell().setbackgroundcolor(basecolor.white); tabla.setheaderrows(5); // add header rows  for(int i=1; i<=5; i++) {   celda = new pdfpcell();   paragraph encabezado = new paragraph("header "+i);           celda.addelement(encabezado);   celda.setgrayfill(0.8f);   tabla.addcell(celda); }               // add cells                for(int k=0; k<19; k++) {   celda = new pdfpcell();   paragraph contenido = new paragraph("cell "+k, helvetica11);   celda.addelement(contenido);                         tabla.addcell(celda); } // in total add 4 rows  tabla.completerow();  document.add(tabla); document.close(); 

normally table cells filled data sql query, can return 1 or many records, have filled table single "for" cycle show malfunction.

someone me how solve problem? parameter should set? or idea?

your table consists of nothing header rows. there no real data in table.

you should change:

tabla.setheaderrows(5); 

into:

tabla.setheaderrows(1); 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -