The cell won't stretch to the next page if there's nothing on it. Maybe it should.
> -----Original Message----- > From: Amit Gijare [mailto:[EMAIL PROTECTED] > Sent: Friday, April 29, 2005 8:16 AM > To: Paulo Soares; [email protected] > Subject: RE: [iText-questions] Cell events and page breaks, > > I expected that the cell should extend as it does have > its childs table extended below, the container cell > (green) is extended but not the inside cell(yellow) > with the event. In case you change the paper layout > from A6 to A4 then you could see that it looks > properly, like the childs of nodes test1 and test 0. > If you try to put the same event on the container > cell(green) line extends over the next page. > > thanks, > amit. > > > > --- Paulo Soares <[EMAIL PROTECTED]> wrote: > > > Everything is working as expected. The event doesn't > > extend to the other > > page because the cell that has the event (yellow) is > > only rendered in > > the first page. Why should it also be rendered in > > the second page? > > > > > -----Original Message----- > > > From: Amit Gijare [mailto:[EMAIL PROTECTED] > > > Sent: Thursday, April 28, 2005 12:57 PM > > > To: Paulo Soares; > > [email protected] > > > Subject: RE: [iText-questions] Cell events and > > page breaks, > > > > > > hi, > > > > > > One more thing I found out in this respect is > > that > > > if you put the cell event on the container cell > > (the > > > cell with green cell background) the cell event is > > > rendered and lines extend on the next pages, but > > > anything inside these cell do not. > > > > > > thanks, > > > amit. > > > > > > --- Amit Gijare <[EMAIL PROTECTED]> wrote: > > > > > > > Hi, > > > > > > > > below is the test code, you could run this > > code, > > > > the yellow background cells are the one where > > cell > > > > event is fired for drawing the lines but they do > > not > > > > extend to other page while the cell in which > > they > > > > are extend, green background.. > > > > > > > > thanks, > > > > amit. > > > > > > > > public class TestClass > > > > { > > > > private static int _signLength = 30; > > > > public static void main (String args[]) > > > > { > > > > createDocumentation(); > > > > } > > > > private static void createDocumentation( ) > > > > { > > > > final Document document = new Document( > > > > PageSize.A6 ); > > > > /// A4 or other sizes > > > > try > > > > { > > > > final PdfWriter writer = > > > > PdfWriter.getInstance( document, new > > > > FileOutputStream( "Test.pdf ") ); > > > > document.open(); > > > > final PdfPTable table = new > > PdfPTable( 1 > > > > ); > > > > table.getDefaultCell().setPadding( 0 > > ); > > > > table.getDefaultCell().setBorder( 0 > > ); > > > > table.setSplitRows( true ); > > > > table.setSplitLate( false ); > > > > table.setWidthPercentage( 98 ); > > > > Map tree= prepareNodeData(); > > > > table.setHorizontalAlignment( > > > > Element.ALIGN_LEFT ); > > > > final PdfPTable table1 = > > > > generatePDFDocument( writer, tree, document ); > > > > table.addCell( table1 ); > > > > document.add( table ); > > > > table.setSplitRows( true ); > > > > document.newPage(); > > > > writer.setPageEmpty( false ); > > > > document.newPage(); > > > > } > > > > catch ( Exception e ) > > > > { > > > > e.printStackTrace( ); > > > > } > > > > document.close(); > > > > } > > > > private static PdfPTable > > generatePDFDocument( > > > > final PdfWriter writer, final Map tree, Document > > > > document ) throws Exception > > > > { > > > > return getPDFStructure( writer, tree, > > "0", > > > > 350, 0, document, 0 ); > > > > } > > > > private static PdfPTable getPDFStructure( > > final > > > > PdfWriter writer, final Map tree, final String > > > > nodeID,int descLength, > > > > final int depth, Document > > > > document, int childCount ) throws IOException, > > > > DocumentException > > > > { > > > > int signLength = 30; > > > > final Node node = (Node)tree.get( nodeID > > ); > > > > if ( descLength < 0 ) > > > > { > > > > descLength = 100; > > > > } > > > > final float width[] = {signLength, > > > > descLength > > > > }; > > > > final PdfPTable table = getPDFTable( > > width > > > > ); > > > > table.getDefaultCell().setNoWrap( false > > ); > > > > table.setTotalWidth( signLength + > > descLength > > > > ); > > > > table.setLockedWidth( true ); > > > > > > > > table.getDefaultCell().setHorizontalAlignment( > > > > Element.ALIGN_LEFT ); > > > > table.setHorizontalAlignment( > > > > Element.ALIGN_LEFT ); > > > > PdfPTable tableSign = getSignTable( node > > ); > > > > PdfPCell cell = new PdfPCell( tableSign > > ); > > > > cell.setBackgroundColor( Color.GREEN ); > > > > table.addCell( cell ); > > > > PdfPTable innerTable = getIconTable( > > > > node,writer, tree, descLength - signLength, > > depth, > > > > document, childCount ); > > > > PdfPCell cell1 = new PdfPCell( > > innerTable ); > > > > table.addCell( cell1 ); > > > > return table; > > > > } > > > > private static PdfPTable getPDFTable( final > > > > float[] width ) > > > > { > > > > final PdfPTable table = new PdfPTable( > > width > > > > ); > > > > table.getDefaultCell().setPadding( 0 ); > > > > table.getDefaultCell().setBorder( 0 ); > > > > > > > > table.getDefaultCell().setHorizontalAlignment( > > > > Element.ALIGN_LEFT ); > > > > table.setExtendLastRow( true ); > > > > table.setSplitRows( true ); > > > > table.setSplitLate( false ); > > > > return table; > > > > } > > > > > > > > private static PdfPTable getIconTable( > > final > > > > Node node, final PdfWriter writer, final Map > > tree, > > > > final int > > > > descLength, int depth, Document > > > > document, int > > > > childCount ) throws IOException, > > > > DocumentException > > > > { > > > > final float[] outerWidth = {10 + 22 + > > 100 + > > > > 16 }; > > > > final PdfPTable outerTable = > > getPDFTable( > > > > outerWidth ); > > > > outerTable.setHorizontalAlignment( > > > > Element.ALIGN_LEFT ); > > > > final float[] width = {10, 22, 100, 16}; > > > > final PdfPTable table = getPDFTable( > > width > > > > ); > > > > > > > > table.setSplitRows( false ); > > > > table.setSplitLate( true ); > > > > > > > > table.setHorizontalAlignment( > > > > Element.ALIGN_LEFT ); > > > > table.setTotalWidth( 10 + 22 + 100 + 16 > > ); > > > > table.setLockedWidth( true ); > > > > final PdfPCell cellLine = new PdfPCell( > > new > > > > Phrase ("--"));// cell with line > > > > final PdfPCell cellIcon = new PdfPCell( > > new > > > > Phrase ("|X|"));// cell with ObjectIcon; > > > === message truncated === > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > ------------------------------------------------------- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id5hix _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
