Columns

Contact Us or call 1-877-932-8228
Columns

Columns

Creating a column-layout in FO is very easy. Simply add a column-count attribute to the relevant region-body FO. You control the width between columns with the column-gap attribute. The example below illustrates this.

Code Sample:

PageLayout/Demos/Columns.fo
<?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="StoriesOdd" 
			page-height="11in" page-width="8.5in" margin=".5in" reference-orientation="90">
			<fo:region-body margin=".5in" column-count="3"  column-gap=".5in"/>
			<fo:region-before region-name="oddHead" extent=".5in" />
			<fo:region-after region-name="oddFoot" extent=".5in" />
		</fo:simple-page-master>
		
		<fo:simple-page-master master-name="StoriesEven" 
			page-height="11in" page-width="8.5in" margin=".5in" reference-orientation="90">
			<fo:region-body margin=".5in" column-count="3" column-gap=".5in"/>
			<fo:region-before region-name="evenHead" extent=".5in" />
			<fo:region-after region-name="evenFoot" extent=".5in" />
		</fo:simple-page-master>
---- C O D E   O M I T T E D ----
<fo:flow flow-name="xsl-region-body">
			<fo:block font-weight="bold" font-size="larger" break-before="column">
				POOH GOES VISITING - A.A. Milne
			</fo:block>
---- C O D E   O M I T T E D ----
<fo:block font-weight="bold" font-size="larger" break-before="column">
				A MAD TEA-PARTY - Lewis Carroll
			</fo:block>
---- C O D E   O M I T T E D ----
<fo:block font-weight="bold" font-size="larger" break-before="column">
				THE NAUGHTY BOY - Hans Christian Andersen
			</fo:block>
---- C O D E   O M I T T E D ----
</fo:flow>
		
	</fo:page-sequence>
</fo:root>

The output is shown in PageLayout/Demos/Columns.pdf. Notice that each story title begins at the beginning of a column. We forced this by setting the break-before attribute of the block containing the title to "column". We also set the reference-orientation of the simple-page-master FO to "90" to create a landscape layout.

Next