rizwan rizwan - 5 months ago 29
Java Question

How to split long tables across multiple slides in ppt using apache POI

I am trying to export tables to PPT using POI. But my tables can contain n number of rows.

The problem is that the entire table is displayed in the same slide. I want to split the table across slides depending on the number of rows.


I may be missing something, but what's wrong with the obvious?

 Slide slide = hslf.createSlide();
 int rows = 0;
 int maxRowsPerSlide = 10; // Tune this

 for(MyRowThingy row : getMeMyRows()) {
     doAddRowToSlide(row, slide);

     if(rows % maxRowsPerSlide == 0) {
        // Slide is full, time for a new slide!
        slide = hslf.createSlide();