Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Problems with borders in tables

$
0
0
I'm new to Aspose, so i apologise if i've missed something obvious.

I creating a data table with a number of rows, however I'm having problems with the table stretching across multiple pages and messing up the cell borders.

This snippet of java code can be used to reproduce the problem:

    public static void main(String[] args) throws Exception {
        Pdf pdf = new Pdf();
        Section s = new Section();
        pdf.getSections().add(s);
        s.isLandscape(true);

        Table table = new Table(s);

        //Set default cell border using BorderInfo object
        table.setDefaultCellBorder(new BorderInfo(BorderSide.All, 0.1F));

        //Set table border using another customized BorderInfo object
        table.setBorder(new BorderInfo(BorderSide.All, 1F));

        //Create MarginInfo object and set its left, bottom, right and top margins
        MarginInfo margin = new MarginInfo();

        margin.setLeft(5f);
        margin.setRight(5f);
        margin.setTop(5f);
        margin.setBottom(5f);

        //Set the default cell padding to the MarginInfo object
        table.setDefaultCellPadding(margin);

        for (int i = 0; i< 100; i++) {
            Row r = table.getRows().add();
            r.getCells().add(i + "-1");
            r.getCells().add(i + "-2");
            r.getCells().add(i + "-3");
        }

        s.getParagraphs().add(table);


        System.out.println("123");
        pdf.save("C:\\temp\\" + System.currentTimeMillis() + ".pdf");
    }

For info we're using version 4.5.0 of the aspose-pdf.jar

Viewing all articles
Browse latest Browse all 3131

Trending Articles