Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
765
Understanding Page Breaks
posted

Hi

I have a report that contains several section grids (section.AddGrid) and several pages that contain images (section.AddPage page.AddImage)

after writting a grid I did section.AddPageBreak to make sure that the next item will start on a new page , I found the following problem

if the last item was a grid then the AddPageBreak added an extra empty page to the end of the document.

If after a grid I called section.AddPage for an image , then inbetween there was an empty page.

My understanding of AddPageBreak was to make sure that the NEXT item will start from a new page but seems that it add a new page always.

my workaround was to call AddPageBreak before I start a new grid and ONLY if the previous item was also a grid but this is not clean code.

is there something more elegant I can do . something that will tell the section to start a new page BUT ONLY if there is something new to add.

Thanks.

Parents
No Data
Reply
  • 469350
    Offline posted

    How are you exporting the grid? Which overload of the export method are you using?

    My guess is that this has something to do with sections. The grid exports to a new section. So when you export the grid, it will always start on a new page, anyway. Perhaps instead of adding a page break, you should create a section for each item you export and then call the Export method that exports to a section you supply? 

Children