Document generation layout

1
Im facing a problem where the title of paragraph could show on one page and the paragraph itself is shown on the next page. Is there a way make sure that if there is not enough space on the page for the title and associated text to fit, both the title and associated text go the next page? Or is there a widget like MS Word, where I can see the pages so I know where to put whitespaces? 
asked
3 answers
1

Hi Jannes,

there is a way, but it has a drawback. You can add certain CSS styling on a table (for example, a table within a template grid). The CSS you are looking for is:  “page-break-inside: avoid;” (see screenshot)

This will only break a page when the contents of the table does not fit within the page, and adds a page break there and then (if the contents does fit, the page break is not added)

Here comes the drawback: if the contents of your table does not fit on a single page at all, the data will be truncated (the last part will be cut off and will not break to the next page). In an earlier project we decided to go for the page break solution (the ‘page break’ widget is not allowed in a template grid, but you can again use the css property “page-break-after: always;” on the same table in order to force the break inside a template grid…

Note that this was working in Mendix 7.9.0, but since the document template functionality has not evolved since then I highly doubt things will be different for newer projects..

answered
0

The Mendix document generation functions are rather basic. If you want to do more advanced stuff, your may want to consider one of the appstore components for this, like

https://appstore.home.mendix.com/link/app/2026/

https://appstore.home.mendix.com/link/app/106722/

https://appstore.home.mendix.com/link/app/111539/

answered
0

Hi Jannes,

A simple solution is to generate a page/document per paragraph/item in a loop, put all documents in a list and after creating all pages (which are guaranteed to start with the header/title) merge the documents using MergeMultiplePdfs from the CommunityCommons app store module.

If this fits your use case however is up to you.

Good luck!

answered