2

I am using an HTML frame component in the print composer, which displays a table.

The composer is controlled by Atlas, meaning I cannot know before-hand what the maximum height of the table will be.

I have set the HTML frame->Item properties->Frames->Resize mode: "Extend to next page".

This produces the following result:

enter image description here

If I set the HTML frame to "Repeat until finished", then this happens (because on the first page, the table does not start from the top, which is as it should):

enter image description here

I know that I can move the frame when set to "Extend to next page", but my placement is lost after I navigate to the next Atlas item.

Any (simple) solutions? I don't mind solutions that use HTML/CSS/Python, but I don't want to over-extend like creating a new composer plugin.

I am using QGIS 2.18 for Windows.

Edit: this is what I want to achieve, but automatically for every Atlas item. enter image description here

2 Answers 2

2

Good news is that this is possible:

  1. Create a composition with the number of pages set to the maximum number of pages you expect the table to need to extend to.
  2. Instead of selecting "repeat until finished" or "extend to next page" modes on your HTML frame, set it to "Use existing frames". Then you need to manually create multiple frames using the "Add Frame" button. Create additional frames for each of the pages and position them exactly where you want on the page.
  3. Since you only want to output pages where there is content in the frame (eg for a short table you only want the first page exported and don't want additional blank pages), you must set the "Don't export page if frame is empty" option on all the additional HTML frames. If this setting is checked then QGIS will skip the page containing the frame IF the frame isn't required when drawing the HTML content.

This approach means that you can fill all the additional pages with extra content like header/footer text, logos, etc and the page will still only be exported when required.

1
  • 1
    The thing is that I don't know beforehand what data each record will have. Is there no other way than to create manually 100+ pages and frames (and even then just hoping the table won't expand past 100 pages?)
    – pkExec
    Commented Jan 18, 2017 at 7:59
0

I was able to extend to next pages with it keeping the table position and size as the first one I set up (using just qgis available tools). However tables had to start and end in the same position on all the pages so I worked around the design by by beginning the table as its own section with a separate cover page. This way first page of the table is the same as the rest in its positioning.

By the way are you or anyone able to add footer to all your table pages? I am struggling with this right now.

1
  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Mar 17, 2023 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.