diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 96f83f7..08333c9 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -1201,6 +1201,7 @@ BandDesignIntf *ReportRender::renderData(BandDesignIntf *patternBand) void ReportRender::startNewColumn(){ if (m_currentColumn < m_maxHeightByColumn.size()-1){ m_currentColumn++; + checkLostHeadersInPrevColumn(); } else { savePage(); startNewPage(); @@ -1339,6 +1340,38 @@ void ReportRender::checkLostHeadersOnPrevPage() } +void ReportRender::checkLostHeadersInPrevColumn() +{ + QVector lostHeaders; + + QMutableListIteratorit(m_renderPageItem->bands()); + + it.toBack(); + if (it.hasPrevious()){ + if (it.previous()->isFooter()){ + if (it.hasPrevious()) it.previous(); + else return; + } + } + + while (it.hasPrevious()){ + if (it.value()->isHeader()){ + if (it.value()->reprintOnEachPage()){ + delete it.value(); + } else { lostHeaders.append(it.value());} + it.remove(); + it.previous(); + } else break; + } + + if (lostHeaders.size() > 0){ + qSort(lostHeaders.begin(), lostHeaders.end(), bandLessThen); + foreach(BandDesignIntf* header, lostHeaders){ + registerBand(header); + } + } +} + BandDesignIntf* ReportRender::findEnclosingGroup() { BandDesignIntf* result=0; diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index 8cbbc0f..541f325 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -157,6 +157,7 @@ private: void checkFooterGroup(BandDesignIntf* groupBand); void pasteGroups(); void checkLostHeadersOnPrevPage(); + void checkLostHeadersInPrevColumn(); BandDesignIntf* findEnclosingGroup(); bool registerBand(BandDesignIntf* band, bool registerInChildren=true);