rizwan rizwan - 1 year ago 68
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.

Answer Source

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();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download