Hi,
I have a problem with the definition as follows: 
http://stackoverflow.com/questions/19490119/itext-table-deletebodyrow-within-rowspans-causes-error
<http://stackoverflow.com/questions/19490119/itext-table-deletebodyrow-within-rowspans-causes-error>
  
In short;
When I run the following code;

public static void main(String[] args) throws Exception {
                int totalSum = 0;
                Document document = new Document();
        PdfWriter.getInstance(document, new
FileOutputStream("c:/sample.pdf"));
        document.open();
        
        PdfPTable table = new PdfPTable(3);
                table.setWidths(new int[]{1,1,1});
                table.setTotalWidth(document.right() - document.left());
                table.setLockedWidth(true);
                
                
table.addCell("Header");table.addCell("Header");table.addCell("Header");
                
table.addCell("Footer");table.addCell("Footer");table.addCell("Footer");
                table.setHeaderRows(2);
                table.setFooterRows(1);
                
                for (int j = 0; j < 10; j++) {
                        table.getDefaultCell().setRowspan(20);
                        table.addCell(new Phrase("Spanning Row : "+j));
                        table.getDefaultCell().setRowspan(1);
                        for (int i = 0; i < 20; i++) {
                                table.addCell(new Phrase("Row Num : "+i));      
                                table.addCell(new Phrase("Blah blah..."));
                                document.add(table);
                                table.deleteBodyRows();
                                totalSum += i;  // if the page break occures 
i'll write current totalSum
to the page footer
                        }

                }
                document.add(table);
                document.close();
        }

I get ArrayIndexOutOfBoundException -1; at
com.itextpdf.text.pdf.PdfPTable.rowSpanAbove(PdfPTable.java:605)

If I don't add header to table then I get;
java.lang.NullPointerException; at
com.itextpdf.text.pdf.PdfPTable.rowSpanAbove(PdfPTable.java:601)

I am using IText 5.4.4. It seems bug to me or am i doing something wrong???




--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/table-deleteBodyRows-within-rowspan-causes-exception-tp4659379.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to