asp.net - How to split columns in itextsharp? -


i have 200 columns.i want set 50 columns in 1 page,total 4 page.i used

doc.newpage()  

but not affect in page?how can split 200 column 50 in 4 pages.now looks like

enter image description here

there different ways this.

the first way explained in answer question what's easy print "first right, down"?

in tabletemplate example, write full table pdftemplate bigger single page:

pdfptable table = new pdfptable(15); table.settotalwidth(1500); pdfpcell cell; (int r = 'a'; r <= 'z'; r++) {     (int c = 1; c <= 15; c++) {         cell = new pdfpcell();         cell.setfixedheight(50);         cell.addelement(new paragraph(string.valueof((char) r) + string.valueof(c)));         table.addcell(cell);     } } pdfcontentbyte canvas = writer.getdirectcontent(); pdftemplate tabletemplate = canvas.createtemplate(1500, 1300); table.writeselectedrows(0, -1, 0, 1300, tabletemplate); 

once table completed, can distribute tabletemplate object on different pages:

for (int j = 0; j < 1500; j += 500) {     (int = 1300; > 0; -= 650) {         clip = canvas.createtemplate(500, 650);         clip.addtemplate(tabletemplate, -j, 650 - i);         canvas.addtemplate(clip, 36, 156);         document.newpage();     } } 

if want do, question duplicate of itext -- what's easy print "first right, down"

the second way use writeselectedrows() method. in case, question duplicate of auto split columns using itextsharp , itextsharp: adjust 2 elements on 1 page

the zhang example second edition of itext in action shows how method works:

pdfcontentbyte canvas = writer.getdirectcontent(); // draw first 2 columns on 1 page table.writeselectedrows(0, 2, 0, -1, 236, 806, canvas); document.newpage(); // draw remaining 2 columns on next page table.writeselectedrows(2, -1, 0, -1, 36, 806, canvas); 

the first time, use writeselectedrows, draw column 0 2 (not included) , row 0 total number of rows on page. second time, draw columns, starting column 2, , rows.

the third way adapt size of page size of table. explained in answer question how define page size based on content?


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -