I'm using Apache FOP 2.9.
I have a two column layout that's frequently interrupted by blocks that span all columns.
All text appears in the correct columns, but the space-before
and space-after
attributes are ignored. What's the correct way to add spacing after a block that spans multiple columns?
<?xml version="1.0" encoding="UTF-8" ?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="two-col">
<fo:region-body column-count="2" column-gap="1cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="two-col">
<fo:flow flow-name="xsl-region-body">
<fo:block span="all" space-after="1cm">
Span all.
</fo:block>
<fo:block space-before="1cm">
Left column.
</fo:block>
<fo:block break-before="column" space-before="1cm">
Right column.
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
I've dealt with the same issue, space-befores and space-afters don't work as expected when you switch from span="all"
to span="none"
in Apache FOP.
Use an explicit 1cm block-container to separate the two areas.
<fo:flow flow-name="xsl-region-body">
<fo:block span="all">
Span all.
</fo:block>
<fo:block-container span="all" height="1cm">
<fo:block> </fo:block>
</fo:block-container>
<fo:block>
Left column.
</fo:block>
<fo:block break-before="column" >
Right column.
</fo:block>
</fo:flow>