Search code examples
javapdfbox

In easyTable "java", is there a possibility to access the last row i created?


in TableBuilder exactly , can i access the last row ?

There is nothing in the doc of the library explains how to do it


Solution

  • If you are using this easytable library, when you try to build a Row, it will return the Row Object to you:

    public Row build() {
        final Row row = new Row(cells);
        row.settings = settings;
        row.height = height;
    
        return row;
    }
    

    So before you call addRow() to add your last Row to Table, you can assign your last Row to a variable first.

    Row lastRow = Row.builder().build();
    Table table = Table.builder().addRow(lastRow);
    

    And you can get access to last Row with lastRow.