diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 08333c9..81523df 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -148,7 +148,8 @@ void ReportRender::renameChildItems(BaseDesignIntf *item){ ReportRender::ReportRender(QObject *parent) :QObject(parent), m_renderPageItem(0), m_pageCount(0), - m_lastRenderedHeader(0), m_lastDataBand(0), m_lastRenderedFooter(0), m_currentColumn(0), m_newPageStarted(false) + m_lastRenderedHeader(0), m_lastDataBand(0), m_lastRenderedFooter(0), + m_currentColumn(0), m_newPageStarted(false), m_lostHeadersMoved(false) { initColumns(); } @@ -490,7 +491,11 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign bandClone->columnsFillDirection()==BandDesignIntf::VerticalUniform)) { startNewColumn(); - if (patternBand->bandHeader() && patternBand->bandHeader()->columnsCount()>1){ + if (patternBand->bandHeader() && + patternBand->bandHeader()->columnsCount()>1 && + !m_lostHeadersMoved && + patternBand->bandNestingLevel() == 0 + ){ renderBand(patternBand->bandHeader(), 0, mode); } } else { @@ -1164,7 +1169,15 @@ BandDesignIntf *ReportRender::saveUppperPartReturnBottom(BandDesignIntf *band, i if (band->columnsCount()>1 && (band->columnsFillDirection()==BandDesignIntf::Vertical || band->columnsFillDirection()==BandDesignIntf::VerticalUniform)){ - startNewColumn(); + startNewColumn(); + if (patternBand->bandHeader() && + patternBand->bandHeader()->columnsCount()>1 && + !m_lostHeadersMoved && + patternBand->bandNestingLevel() == 0 + ){ + renderBand(patternBand->bandHeader(), 0, StartNewPageAsNeeded); + } + } else { savePage(); startNewPage(); @@ -1332,12 +1345,16 @@ void ReportRender::checkLostHeadersOnPrevPage() } if (lostHeaders.size() > 0){ + m_lostHeadersMoved = true; qSort(lostHeaders.begin(), lostHeaders.end(), bandLessThen); foreach(BandDesignIntf* header, lostHeaders){ registerBand(header); } + } else { + m_lostHeadersMoved = false; } + } void ReportRender::checkLostHeadersInPrevColumn() @@ -1365,10 +1382,13 @@ void ReportRender::checkLostHeadersInPrevColumn() } if (lostHeaders.size() > 0){ + m_lostHeadersMoved = true; qSort(lostHeaders.begin(), lostHeaders.end(), bandLessThen); foreach(BandDesignIntf* header, lostHeaders){ registerBand(header); } + } else { + m_lostHeadersMoved = false; } } diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index 541f325..d31efce 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -215,6 +215,7 @@ private: QVector m_columnedBandItems; unsigned long long m_currentNameIndex; bool m_newPageStarted; + bool m_lostHeadersMoved; }; } // namespace LimeReport