Example #1
0
  public void exportAll(DataTable table, Writer writer) throws IOException {
    int first = table.getFirst();
    int rowCount = table.getRowCount();
    int rows = table.getRows();
    boolean lazy = table.isLazy();

    if (lazy) {
      for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
        if (rowIndex % rows == 0) {
          table.setFirst(rowIndex);
          table.loadLazyData();
        }

        exportRow(table, writer, rowIndex);
      }

      // restore
      table.setFirst(first);
      table.loadLazyData();
    } else {
      for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
        exportRow(table, writer, rowIndex);
      }

      // restore
      table.setFirst(first);
    }
  }