When I ran the example it looks just fine. The first
time you add the nested table its two columns are in
one single-column cell of the outer table. The next
time, the nested table has its two columns stretched
into a two-column cell, making it look like part of
the original table. Where is the problem?
-Matt
--- Khaled Alakhras <[EMAIL PROTECTED]> wrote:
>
> What you describing is the desired effect, however
> if you look at the example, the first nested table
> is added to a cell with colSpan of 1 and the seconed
> nested table is added to a cell with a colSpan of 2.
> The second table shows up correctly spanning two
> columns, but the first nested table shows up
> spanning two columns also which is incorrect.
> Thanks,
> Khaled
>
> Paulo Soares <[EMAIL PROTECTED]> wrote:Works
> correctly. If you have colspan 2 the nested table
> inside will occupy
> the two columns space instead of one. What result
> would you expect?
>
> Best Regards,
> Paulo Soares
>
> > -----Original Message-----
> > From: Khaled Alakhras [SMTP:[EMAIL PROTECTED]]
> > Sent: Wednesday, November 06, 2002 21:37
> > To: [EMAIL PROTECTED]
> > Subject: [iText-questions] Setting the colSpan on
> a PdfPCell that
> > contains a PdfPTable
> >
> > It seems that there is a problem when setting the
> colSpan of a PdfPCell
> > that contains a PdfPTable. Setting the colSpan
> effects all other cells
> > that contain a PdfPTable also. Please see attahced
> example.
> >
> > Thanks,
> > Khaled
> >
> > Test.java
> >
> > import com.lowagie.text.Document;
> >
> > import com.lowagie.text.PageSize;
> >
> > import com.lowagie.text.Phrase;
> >
> > import com.lowagie.text.pdf.PdfPCell;
> >
> > import com.lowagie.text.pdf.PdfPTable;
> >
> > import com.lowagie.text.pdf.PdfWriter;
> >
> > import java.awt.Color;
> >
> > import java.io.FileOutputStream;
> >
> >
> >
> > public class Test
> >
> > {
> >
> > public static void main(String[] args)
> >
> > {
> >
> > Document document = new Document(PageSize.A4, 50,
> 50, 50, 50);
> >
> > try
> >
> > {
> >
> > PdfWriter writer = PdfWriter.getInstance(document,
> new
> > FileOutputStream("test.pdf"));
> >
> > document.open();
> >
> > PdfPCell cell;
> >
> > PdfPTable table = new PdfPTable(2);
> >
> > table.setWidthPercentage(70);
> >
> > table.setHeaderRows(0);
> >
> > cell = table.getDefaultCell();
> >
> > cell.setBorderWidth(1);
> >
> > cell.setBorderColor(Color.blue);
> >
> > // Create a 2X2 sub-table
> >
> > PdfPTable nested = new PdfPTable(2);
> >
> > for (int k = 0; k < 4; ++k)
> >
> > {
> >
> > cell = new PdfPCell(new Phrase("nested.Cell " +
> k));
> >
> > cell.setBorderWidth(1);
> >
> > cell.setBorderColor(Color.blue);
> >
> > cell.setBackgroundColor(Color.red);
> >
> > nested.addCell(cell);
> >
> > }
> >
> > cell = new PdfPCell(new Phrase("Table.Cell0"));
> >
> > cell.setBorderWidth(1);
> >
> > cell.setBackgroundColor(Color.blue);
> >
> > table.addCell(cell);
> >
> > cell = new PdfPCell(new Phrase("Table.Cell1"));
> >
> > cell.setBorderWidth(1);
> >
> > cell.setBackgroundColor(Color.blue);
> >
> > table.addCell(cell);
> >
> > cell = new PdfPCell(new Phrase("Table.Cell2"));
> >
> > cell.setBorderWidth(1);
> >
> > cell.setBackgroundColor(Color.blue);
> >
> > table.addCell(cell);
> >
> > cell = new PdfPCell(nested);
> >
> > cell.setBorderWidth(1);
> >
> > cell.setColspan(1);
> >
> > cell.setPadding(1);
> >
> > table.addCell(cell);
> >
> > cell = new PdfPCell(nested);
> >
> > cell.setBorderWidth(1);
> >
> > cell.setColspan(2); //** NOTE: setting the colspan
> for this cell effects
> > all other cells that
> >
> > //** contain a table.
> >
> > cell.setPadding(1);
> >
> > cell.setBackgroundColor(Color.blue);
> >
> > table.addCell(cell);
> >
> > document.add(table);
> >
> > document.close();
> >
> > }
> >
> > catch (Exception de)
> >
> > {
> >
> > de.printStackTrace();
> >
> > }
> >
> > }
> >
> > }
> >
> >
> >
> > _____
> >
> > Do you Yahoo!?
> > HotJobs -
> > Search new jobs daily now
>
>
> ---------------------------------
> Do you Yahoo!?
> U2 on LAUNCH - Exclusive medley & videos from
> Greatest Hits CD
__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2
-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions