class DataTable {

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        
        int totalWidth = 0;
        int colCount = getColumnsCount();
        List<Integer> colWidths = new ArrayList<>();
        
        for (int i = 0; i < colCount; i++) {
            List<String> col = getColumn(i);
            int colWidth = 0;
            for (int j = 0; j < col.size(); j++) {
                colWidth = Math.max(colWidth, col.get(j).length());
            }
            colWidths.add(colWidth);
            totalWidth += colWidth;
        }
        
        String line = "+" + StringUtils.repeat("-", totalWidth + colCount - 1) + "+";
        
        for(int i = 0; i < getRowsCount(); i++) {
            List<String> row = getRow(i);

            sb.append("\n").append(line).append("\n");
            for(int j = 0; j < colWidths.size(); j++) {
                // TODO: fix padding for arabic when unprintable chars are present
                // TODO: ensure unprintable characters are not counted when padding (all columns have same width)
                String cellPadded = rightPad("", colWidths.get(j));
                
                if(j < row.size()) {
                    cellPadded = isolateRTLIfRequired(rightPad(row.get(j), colWidths.get(j)));
                }

                sb.append("|").append(cellPadded);

            }
            
            sb.append("|");
        }

        sb.append("\n").append(line).append("\n");
        
        return sb.toString();
    }

    public  DataTable(int pageNumber);
    public  DataTable(Collection<Integer> pageNumbers);

}