pdf generation - How can I put data in specific cells in a table on a PDF form using iTextSharp? -


i want create table in pdf , assign values (phrases) specific cells in table.

i assume this:

pdfptable table = new pdfptable(5); // arg number of columns  // row 1 pdfpcell cell = new pdfpcell(doctitle); cell.colspan = 3; cell.borderwidth = 0; cell.horizontalalignment = 0; //0=left, 1=centre, 2=right table.addcell(0, 0, cell); // <= col 0, row 0. expect able 

...but example code i've found adds cells table, 1 after other, without specifying cell of table cell data should associated with. such as:

pdfptable table = new pdfptable(5); // arg number of columns  // row 1 pdfpcell cell = new pdfpcell(doctitle); cell.colspan = 3; cell.borderwidth = 0; cell.horizontalalignment = 0; //0=left, 1=centre, 2=right table.addcell(cell);  // row 2 pdfpcell cellcaveat = new pdfpcell(subtitle); cellcaveat.colspan = 2; cellcaveat.borderwidth = 0; table.addcell(cellcaveat);  // row 3 pdfpcell cellimportantnote = new pdfpcell(importantnotice); cellimportantnote.colspan = 5; cellimportantnote.borderwidth = 0; table.addcell(importantnotice); 

is there more specific way add cells table 1 @ time, hoping placed in right spot?

note: doctitle, subtitle, , importantnotice paragraphs have been created, so:

var titlefont = fontfactory.getfont(fontfactory.courier_bold, 11, basecolor.black); var doctitle = new paragraph("ucsc - direct payment form", titlefont); doc.add(doctitle); 


Popular posts from this blog