3

I'm trying to get a 10mm space between region-before and region-body. But I'm not able to get it relativ to the size of regin-before.

Thats how it should be.

Thats how the border should be. With a single-lined 'Bemerkung' it works. But as soon as it gets double- or three-lined, the body won't be bushed down, but stays at the same position, as seen here:

enter image description here

My layout-master-set looks like that:

<fo:layout-master-set>
    <fo:simple-page-master master-name="Stueckliste"
        margin="{$Innenraender}" page-height="{$SeitenhoeheA4}" page-width="{$SeitenbreiteA4}">
        <fo:region-body region-name="xsl-region-body"
            margin="45mm 0mm 17mm 0mm" />
        <fo:region-before extent="80mm" display-align="before"
            region-name="xsl-region-before" />
        <fo:region-after region-name="xsl-region-after"
            extent="50mm" display-align="after" margin="30mm 0mm 40mm 0mm" />
    </fo:simple-page-master>
</fo:layout-master-set>

The region-before surounding:

<fo:static-content flow-name="xsl-region-before">
  ...
</fo:static-content>

The region-body surounding:

<fo:flow flow-name="xsl-region-body">
   ...
</fo:flow>

Where is the mistake?

  • 1
    I guess it's hard - you should add some more mm to the top margin of the region-body but then this space will always be there even if the Bemerkung is only one line. But maybe an expert drops in and can explain how you can achieve it. How do you generate the fo-file? Would there be a way that the generator already estimates that the header is bigger and the body should have a bigger top margin? – Stefan Hegny Jul 21 '16 at 11:48
  • Thank you. I thought that there must be a way to just set the space between header and body, no matter how big the header is. I'm generating it via xml. So I'd be able to check if the Bemerkung is so long that it needs two or three lines. Thereupon i could set the extent of the region-before. But I really thought that there has to be an easier way to do that... hm... – MrOnkelChiller Jul 21 '16 at 11:56
  • 1
    I agree, but the region based layout model probably sees the regions rather independent... Another idea would be to try to add the Stückliste header (and the blank separation) to the below table somehow and get it repeated as table header on each page (omitting the region-before completely) but that probably would be big fiddling with table stuff. – Stefan Hegny Jul 21 '16 at 12:29
  • @StefanHegny Well I think that would be more complicated than figuring out the characters (rows) of the Bemerkung. I'll wait until tomorrow for another answer. If there isn't a better solution i'll count characters... – MrOnkelChiller Jul 21 '16 at 12:41
  • The size of the regions is fixed so you would need to either calculate the size you think you need in the XSLT and set that in the XSL FO or do what was suggested and possibly move some content to the region-body (unless of course it needs to be repeated on other pages). XSL Fo is not like Word where the header grows to accommodate the content, you specify the size. – Kevin Brown Jul 22 '16 at 05:41

1 Answers1

3

There is no error. In XSL FO the height of the regions is fixed. It will not expand (or contract) based on content that exceeds (or is less than) the "extent". If you need the header area to repeat on subsequent pages then you will need to do something (like you suggest like counting characters) to determine some predicted height and set that height in the XSL that produces the XSL FO. Or you could setup a set of page templates with various "extent"s and pick from those based on the character count.

If the header is not to be repeated on subsequent pages (like it was a first page or you will only have one page) then you could move some or all of the content into the body and have no header.

Kevin Brown
  • 8,805
  • 2
  • 20
  • 38