Sign In  Sign Up Live-Chat

Aspose PDF in Java: Table Border for left and top won't work always all borders are shown

Last post 05-18-2008, 8:40 PM by Sandy.Zhang. 4 replies.
Sort Posts: Previous Next
  •  05-14-2008, 4:13 AM 126856

    Aspose PDF in Java: Table Border for left and top won't work always all borders are shown

    Hello,
    i would like to show the left and top border of a table but always all borders are shown.

    My Code for Aspose PDF in Java:
    ...
    GraphInfo borderGraphInfo = new GraphInfo();
    borderGraphInfo.setLineWidth(1);
    borderGraphInfo.setFillColor(Color.Black);

    BorderInfo borderInfo = new BorderInfo();

    borderInfo.setLeft(borderGraphInfo);
    borderInfo.setTop(borderGraphInfo);

    table.setBorder(borderInfo);
    ...

    thanks for help
    vland
     
  •  05-14-2008, 5:58 AM 126882 in reply to 126856

    Re: Aspose PDF in Java: Table Border for left and top won't work always all borders are shown

    Hi,

    To set the borders of Table , Row and Cell you can use Table.Border , Row.Border and Cell.Border properties of Table , Row and Cell classes respectively.

    All border related properties discussed above are assigned an instance of BorderInfo class, which is created by calling its constructor. BorderInfo Constructor has many overloads that take almost all parameters required to customize the border.

    //Instantiate a table object

    Table table = new Table(sec1);

    //Add the table in paragraphs collection of the desired section

    sec1.getParagraphs().add(table);

    //Set table border using another customized BorderInfo object

    table.setBorder(new BorderInfo(BorderSide.All, 1F));


    In above mentioned constructor All borders are called that can be replaced with Left,Top,Rigth, Bottom.

    For a list of all members of this type,kindly visit BorderInfo Members.


    Nayyer Shahbaz
    Support Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  05-14-2008, 8:02 AM 126911 in reply to 126882

    Re: Aspose PDF in Java: Table Border for left and top won't work always all borders are shown

    Hi,
    sorry but it won't work.

    I tryed this:
    table.setBorder(new BorderInfo(BorderSide.Left, 1F));
    but the the Table shows all Borders not only the left.

    I am using the Aspose PDF Java API.

    Full Code of the Table:

                   Pdf pdf = new Pdf();
                   
                    //add a section
                    Section sec1 = pdf.getSections().add();
                   
                    Table table = new Table(sec1);

                    table.setBorder(new BorderInfo(BorderSide.Left, 1F));

                    table.setColumnWidths("150 150");
                   
                    //add a row
                    Row row1 = new Row(table);
                    table.getRows().add(row1);
                   
                    Cell cell11 = new Cell(table, "some text");
                    row1.getCells().add(cell11);
                   
                    Cell cell12 = new Cell(table,"some more text");
                    row1.getCells().add(cell12);
                   
                    //add another row
                    Row row2 = new Row(table);
                    table.getRows().add(row2);
                   
                    Cell cell21 = new Cell(table,"another some text");
                    row2.getCells().add(cell21);
                   
                    Cell cell22 = new Cell(table,"another some more text");
                    row2.getCells().add(cell22);
                   
                    //add table to sec1
                    sec1.getParagraphs().add(table);


    thanks for your replay
    vland
     
  •  05-14-2008, 2:00 PM 126999 in reply to 126911

    Re: Aspose PDF in Java: Table Border for left and top won't work always all borders are shown

    Hi,

    I have tested the code and was able to reproduce the error. I have logged this as PDFJAVA-5133 in our issue tracking system. we will try our best to resolve this as soon as possible.

    Thanks.

     
  •  05-18-2008, 8:40 PM 127610 in reply to 126911

    Re: Aspose PDF in Java: Table Border for left and top won't work always all borders are shown

    Attachment: Present (inaccessible)
    Hi,
     We have solved this problem. You can get the hofix in the attachment. Your code:
    "
    GraphInfo borderGraphInfo = new GraphInfo();
    borderGraphInfo.setLineWidth(1);
    borderGraphInfo.setFillColor(Color.Black);

    BorderInfo borderInfo = new BorderInfo();

    borderInfo.setLeft(borderGraphInfo);
    borderInfo.setTop(borderGraphInfo);

    table.setBorder(borderInfo);
    "
    can function well in this hotfix. Thank you for considering our product.


    Sandy.Zhang
    Product Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
View as RSS news feed in XML