1

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

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.

  • 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 Jan 18 '17 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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