Hi,

I had conjured up a standalone program for displaying
nested tables. It would show up correctly. However,
when I generalized the program into a more lightweight
framework doing exactly the same steps there are some
issues.

I have specified the border as 0 width. In the
standalone program it doesn't show the border. But
with the framework, it displays the border no matter
what border width or color I put in. I am listing the
code below.

This is the standalone program, which works:
Document doc = new Document();
PdfWriter writer = null;
writer = PdfWriter.getInstance(doc, os);
doc.open();

PdfPTable table = new PdfPTable(2);
                table.getDefaultCell().setBorderWidth(0);
float[] widths = {1.1f,2f};
table.setWidths(widths);

PdfPTable leftTable = createLeftTable();

PdfPTable rightTable = createRightTable();
        
table.addCell(leftTable);
table.addCell(rightTable);
       
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);

However, the same steps are followed in the framework
and it displays the border. The code in the framework
is listed. The document creator calls the
addComponents method, which calls the init for
initializing the base table.

private void init() throws Exception {
        table = (columns == 0) ? 
        new PdfPTable(DEFAULT_COLUMNS) : 
        new PdfPTable(columns);
        try {
                if (columns > 1) {
                        table.setWidths(columnWidths);
                }
        } catch (DocumentException e) {
                throw new Exception(
                "Problem with setting column 
                widths in flow layout.");
        }

table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        table.getDefaultCell().setBorderColor(Color.WHITE);
        table.getDefaultCell().setPadding(0);
}

public void addComponents() 
        throws Exception {
        if (table == null) {
                init();
        }
        Iterator iter = stacks.iterator();
        while (iter.hasNext()) {
                Stack stack = 
                        (Stack) iter.next();
                PdfPTable stackTable = 
                        stack.addSections();
                table.addCell(stackTable);
        }
}

Any help would be highly appreciated.

Thanks.





-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to