I have a simple example that doesn't seem to work in the way I would expect.  
I am tempted to say it's a bug, but of course I may be simply doing something 
wrong or misunderstanding things.  I have a three-column, one-row PdfPTable 
(I'll call this the main table).  Within the first cell, I have a nested one-
column, one-row table; the middle cell of the main table is empty; and the 
third cell of the main table has a one-column, two-row table.  I'm trying to 
get the nested table in the first cell of the main table to sit flush to the 
bottom of the containing cell, so for that containing cell I set 
VerticalAlignment to Element.ALIGN_BOTTOM.  However, what I see is that the 
nested table now extends below its containing cell.  This does not happen if I 
don't set the VerticalAlignment, or if the nested table has two rows instead 
of one.  

I would be grateful if someone could comment on my problem.  A possible work-
around would be to make sure that the two nested tables always have the same 
number of rows, but this is far from ideal in my situation and will not give 
me the desired behavior (although it would be better than the current 
behavior).

Here is the sample code (I am using iTextSharp):

Document doc = new Document(PageSize.LETTER.Rotate());
PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream
("..\\..\\TableTest.pdf", FileMode.Create));
doc.Open();

PdfPTable bigTbl = new PdfPTable(3);

PdfPTable smallTbl = new PdfPTable(1);
PdfPCell cell = new PdfPCell(smallTbl);
cell.VerticalAlignment = Element.ALIGN_BOTTOM;
bigTbl.AddCell(cell);

cell = new PdfPCell(new Paragraph("R1 C1"));
smallTbl.AddCell(cell);

cell = new PdfPCell();
bigTbl.AddCell(cell);

smallTbl = new PdfPTable(1);
cell = new PdfPCell(smallTbl);
bigTbl.AddCell(cell);

cell = new PdfPCell(new Paragraph("R1 C1"));
smallTbl.AddCell(cell);
cell = new PdfPCell(new Paragraph("R2 C1"));
smallTbl.AddCell(cell);

doc.Add(bigTbl);
doc.Close();



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to