2011-11-25 91 views

回答

2

我可能会错过某些东西,但显而易见的问题是什么?

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

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

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

在上面的代码中,我遇到了一个问题,其中最后一张幻灯片将包含多余的列。所以maxRowsPerSlide必须是dynamic.for我使用folowing功能

public int getMaxRowsInOneSlide(int sizeOfTotalRowsArray, int totalCount){ //totalCount is the count of current row 
    int maxRowsPerSlide = 0; 

    if(sizeOfArray - totalCount >= 10){ //10 is the default rows in a slide 
     maxRowsPerSlide = 10; 
    } 
    else{ 
     maxRowsPerSlide = (sizeOfArray - totalCount)+1;    //'+1' because each slide contains a row for the column names in the table 
    } 
    return maxRowsPerSlide; 
} 
} 
相关问题