On 17/09/2010 11:24, Ernst Plüss wrote: > Hi > > I'm trying to create a table which spans several pages using > PdfPTable. The table has a fixed header row. Just after this header row > there's a second row, containing a summery of the contents of the > previous pages. How can I do that?
This should be a second header row. This row should have a fixed height and should have empty cells. Use cell events to gather whichever data needs to be gathered to make the summary, and use cell or table events to fill the empty cells with that data. If this second header row can't appear on the first page, you'll have to use a trick. Use setSkipFirstHeader to make sure NO headers are added on the first page; add the first real header (the single row) as if it were a normal row. > I tried using PdfPageEvent, and add extra cells when a new page > is started. Unfortunately that doesn't work, because the events are not > called while I'm adding cells. No, for tables you need cell and table events, not page events. > It seams that, they are called when the > table is added to the document. The result is, that the extra cells are > added to the end of the table. > > I could add a second header row as an empty place holder. But how can I > calculate the data to fill into this cells, since the data depends on > the cells of the previous page? That's a general programming question. A cell and table events are called AFTER a cell or a table is added to the page. You could keep track of the content of the table on page X in the table event class. Then if the layout method is called, process that content so that it is ready to be added. The layout method will be called a second time as soon as the second part of the table is added to page X + 1. Now add the processed content of page X to the second header row, and process the content of page X + 1 so that it can be added to page X + 2. And so on... -- This answer is provided by 1T3XT BVBA http://www.1t3xt.com/ - http://www.1t3xt.info ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
