Hi all,

I'm having a problem trying to format a pdf report according to what the 
business needs.  I was able to create the pdf without any issues, with a 
header/footer, "page X of Y", etc...  However, I'm having trouble displaying 
groups.  For example, let's say I have the following, a "name" which has a 
bunch of subgroups.  I'm supressing the "name" value if the previous record has 
the same name.  However, if the records rollover to a new page, I want to 
display the "name" again.  I'm finding it hard to do this because I first 
create the PdfPTable and then add it to a ColumnText which displays the data on 
the pdf.  Therefore, I don't know where the pagebreak will occur when creating 
the PdfPTable:

Example of what I'm getting:

Header                              
name abc
         def
         ghi
         etc...
----------------------------------
Footer              Page 1 of 2


Header                                        
         jkl           <--- want "name" to display again since it's a new page.
         mno
         etc...
-----------------------------
Footer               Page 2 of 2


Example of what I need:

Header                              
name abc
         def
         ghi
         etc...
----------------------------------
Footer              Page 1 of 2


Header                              
name jkl           <--- "name" is displayed since it's a new page
         mno
         etc...
----------------------------------
Footer              Page 2 of 2


Below is what I use to display the table. In my example above, the table will 
only have two columns and I want to suppress the first column if it's the same 
as the previous row's first column ( I have no problem with this ) and I want 
to display the first column if it's a new page ( Here's where I have the issue 
):

ColumnText tableCt = new ColumnText(this.cb);   //cb is a PdfContentByte
tableCt.addElement(table);  //table is a PdfPTable
tableCt.setSimpleColumn( this.leftMargin, this.footerHeight, this.pageWidth - 
this.rightMargin, this.headerHeight ); 

try{
         int status = ColumnText.NO_MORE_COLUMN ;
         while((status & ColumnText.NO_MORE_TEXT) == 0){
          status = tableCt.go();
          tableCt.setYLine( 399 );
          doc.newPage();           
         }
 } catch ( DocumentException de ){         
 } 

Please let me anyone has done something similar and can point me in the right 
direction.

Thanks in advance,
Dave
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to