When using a Table that has one cell containing both a paragraph and another
table (which has only 1 cell with a paragraph), I get an
ArrayIndexOutOfBoundsException on line 177 of PdfTable. I think this is
caused by the changes to the PdfTable constructor in iText-paulo-137. When I
test against the 1.02b version, it works fine.

I think the root of the problem is that PdfTable.columns is set early in the
constructor before updateRowAdditionsInternal() is called.  This ends up
calling table.complete() which merges the inner table and changes the number
of columns.  Then, when looping over the columns back in the constructor,
you get an ArrayIndexOutOfBoundsException.  I tried adding table.complete()
earlier in the constructor, but that seemed to cause other problems.  I will
continue to look into this, but would appreciate any help I can get.

I'm also not convinced that table.mergeInsertedTables() is working
correctly - I end up with a 3 row x 3 column table in this case.  That
doesn't seem correct, but I don't quite follow what mergeInsertedTables is
doing.

Here is a fragment of the test code I am using that causes the problem:

    public void testSimpleNesting() throws DocumentException
    {
        Font tableFont = FontFactory.getFont("Helvetica", 8, Font.BOLD,
Color.BLACK);
        Table outerTable = new Table(1);
        Paragraph p = new Paragraph("test", tableFont);

        Table innerTable= new Table(1);
        innerTable.addCell(makeCell(new Element[] {p }, Element.ALIGN_LEFT,
Element.ALIGN_TOP, new Rectangle(100,100)));

        outerTable.addCell(makeCell(new Element[] {p, innerTable},
Element.ALIGN_LEFT, Element.ALIGN_TOP, new Rectangle(100,100)));
        document.add(outerTable);
    }


    Cell makeCell(Element[] elements, int vAlignment, int hAlignment,
Rectangle borders) {
        Cell cell = new Cell();
        if (elements != null) {
            for (int i = 0; i < elements.length; i++) {
                Element el = elements[i];
                cell.add(el);
            }
        }
        cell.setVerticalAlignment(vAlignment);
        cell.setHorizontalAlignment(hAlignment);
        return cell;
    }





-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to