(Keep on the mailing list)

table.setHeaderRows(3) with only 2 rows in the table?

You need PdfPTable.setMaxWidth() to set the table width and
PdfPTable.writeSelectedRows() to output the table. Document.add() won't
work here. 

> -----Original Message-----
> From: Patrick Janssen [mailto:[EMAIL PROTECTED] 
> Sent: Monday, August 29, 2005 10:55 AM
> To: Paulo Soares
> Subject: RE: [iText-questions] is it possible to use tables 
> in combination wth layers?
> 
> Hi, 
> 
> 
> I've read the code, but I still don't grasp how to add/couple 
> layers to
> tables.
> 
> Can you please correct the code or give me a hint
> 
> Regards
> 
> 
>       Document document = new Document(PageSize.A4, 50, 50, 50, 50);
>                   // step 2
>      PdfWriter writer =
> PdfWriter.getInstance(document,outputStream("c://temp/automatic.pdf"))
>       writer.setPdfVersion(PdfWriter.VERSION_1_5);
>       writer.setViewerPreferences(PdfWriter.PageModeUseOC);
>                   // step 3
>       document.open();
>                   // step 4
>                   // some small table
>             float[] widths = {0.26f, 0.15f, 0.30f,.29f};
>               PdfPTable table = new PdfPTable(widths);
>               PdfPCell cell =   new PdfPCell(new 
> Paragraph("some text"));
>               cell.setColspan(4);
>               table.addCell(cell);
>               table.addCell("test");
>               PdfPCell cell2 = new PdfPCell(new Paragraph("Detail"));
>               cell2.setColspan(3);
>               table.addCell(cell2);
>               table.setHeaderRows(3);
>                   
>                               
>             
>                   
>                   
>                   
>       PdfContentByte cb = writer.getDirectContent();
>                
>                               
>       PdfLayer l12 = new PdfLayer("Layer nesting", writer);
>       PdfLayer l1 = new PdfLayer("Layer 1", writer);
>       PdfLayer l2 = new PdfLayer("Layer 2", writer);
>       PdfLayer title = PdfLayer.createTitle("Layer grouping", writer);
>       PdfLayer l3 = new PdfLayer("Layer 3", writer);
>       PdfLayer l4 = new PdfLayer("Layer 4", writer);
>       l12.addChild(l1);
>       l12.addChild(l2);
>       title.addChild(l3);
>       title.addChild(l4);
>       Phrase p1 = new Phrase("Text in layer 1 lskdfd");
>                   
>       Phrase p2 = new Phrase("Text in layer 2");
>       Phrase p3 = new Phrase("Text in layer 3");
>       Phrase p4 = new Phrase("Text in layer 4");
>                  
>       cb.beginLayer(l1);
>                   :: HERE THE TABLE MUST BE ADDED
>                   // add table ????????
>                   //*********************
>                   //********************
>         ColumnText.showTextAligned(cb, Element.ALIGN_LEFT, 
> p1, 50, 600,
> 0);
> // ADDING TABLE DOES NOT WORK
> // 
>                       
>         document.add(table);      
>       cb.endLayer();
>                   
> 
> 
> -----Oorspronkelijk bericht-----
> Van: Paulo Soares [mailto:[EMAIL PROTECTED] 
> Verzonden: zondag 28 augustus 2005 11:40
> Aan: Patrick Janssen; [email protected]
> Onderwerp: Re: [iText-questions] is it possible to use tables 
> in combination
> wth layers?
> 
> Use layers, there are examples in the tutorial.
> 
> ----- Original Message ----- 
> From: "Patrick Janssen" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Saturday, August 27, 2005 7:07 AM
> Subject: [iText-questions] is it possible to use tables in 
> combination wth
> layers?
> 
> 
> > Hi,
> >
> >
> >
> > I have created a nice PDF-document that contains multiple 
> large table.
> >
> >
> >
> > I now want the users to be able to hide/display these 
> tables separatably.
> >
> >
> >
> > Is this possible with Itext?
> >
> >
> >
> > Should I use Layers?
> >
> >
> >
> >
> > P.J.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to