Change Column Count within a page

Top Previous Topic Next Topic  Print this topic

Overview:

Sometimes, blocks must be spanned on multiple columns, or multiple sections with a different column count must be placed on the same page.

 

Solution:

There are 2 different methods to achieve this:

 

1. Using the span="all" attribute on the desired block.

 

The next steps must be followed:

the desired layout with two columns must be created
the content must be added (text, images etc.)
after the block that will span on multiple columns is created, the user must switch to Text View
in Text View, the span="all" attribute must be added on the block, as follows:

 

 

       <fo:block span="all">THIS IS TEXT TO CARRY OVER TWO COLUMNS</fo:block>

 

 

Example of usage:

 

 

<?xml version="1.0" encoding="utf-8"?>

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xf="http://www.ecrion.com/xf/1.0" xmlns:xc="http://www.ecrion.com/2008/xc" xmlns:svg="http://www.w3.org/2000/svg" font-family="Times" font-size="12pt">

       <fo:layout-master-set>

               <fo:simple-page-master master-name="Letter Page" page-width="8.5in" page-height="6in" xf:auto-adjust-regions="false">

                       <fo:region-body region-name="xsl-region-body" column-count="2" margin="0.7in"/>

                       <fo:region-before region-name="xsl-region-before" display-align="after" extent="0.7in"/>

                       <fo:region-after region-name="xsl-region-after" extent="0.7in"/>

                       <fo:region-start region-name="xsl-region-start" extent="0.7in"/>

                       <fo:region-end region-name="xsl-region-end" extent="0.7in"/>

               </fo:simple-page-master>

       </fo:layout-master-set>

       <fo:page-sequence master-reference="Letter Page">

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

                       <fo:block> </fo:block>

               </fo:static-content>

               <fo:static-content flow-name="xsl-region-after">

                       <fo:block> </fo:block>

               </fo:static-content>

               <fo:static-content flow-name="xsl-region-start">

                       <fo:block> </fo:block>

               </fo:static-content>

               <fo:static-content flow-name="xsl-region-end">

                       <fo:block> </fo:block>

               </fo:static-content>

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

                       <fo:block>Text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here</fo:block>

                       <fo:block span="all" background="red">

                               TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT

                       </fo:block>

                       <fo:block>Text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here</fo:block>

               </fo:flow>

       </fo:page-sequence>

</fo:root>

 

 

Output:

 

how_to_change_column_count_1

 

 

2. Using the xf:continuous-sequence attribute.

 

This attribute must be applied in Text View, on the fo:page-sequence element.

Basically, when applied, all consecutive page sequences with this attribute declared are added to the first page sequence as a continuous flow.

 

The next steps must be followed:

different page layouts with the desired column count must be created
one or more page sequences that use the previous created layouts must be created
in Text View, the xf:continuous-sequence="true" attribute must be applied to the appropriate page sequences.

 

In the example below, three page sequences have been declared:

Sequence1 - with column-count="3"
Sequence2 - with column-count="2"
Sequence3 - the column-count is not mentioned and the default value will be applied to the sequence, that is, "1". The page sequence contains a table with four columns.

 

 

<?xml version="1.0" encoding="utf-8" ?>

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xf="http://www.ecrion.com/xf/1.0" xmlns:xc="http://www.ecrion.com/2008/xc" xmlns:svg="http://www.w3.org/2000/svg" font-family="Times" font-size="12pt">

       <fo:layout-master-set>

               <fo:simple-page-master master-name="Sequence1" page-width="8.5in" page-height="7in">

                       <fo:region-body region-name="xsl-region-body" column-count="4" margin="0.7in"/>

                       <fo:region-end region-name="xsl-region-end" extent="0.7in"/>

               </fo:simple-page-master>

               <fo:simple-page-master master-name="Sequence2" page-width="8.5in" page-height="7in">

                       <fo:region-body region-name="xsl-region-body" column-count="3" margin="0.7in"/>

               </fo:simple-page-master>

               <fo:simple-page-master master-name="Sequence3" page-width="8.5in" page-height="7in">

                       <fo:region-body region-name="xsl-region-body" column-count="1" margin="0.7in"/>

               </fo:simple-page-master>

       </fo:layout-master-set>

       <fo:page-sequence master-reference="Sequence1" xf:continuous-sequence="true">

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

                       <fo:block background-color="rgb(255,204,153)">text here...text here</fo:block>

               </fo:flow>

       </fo:page-sequence>

       <fo:page-sequence master-reference="Sequence2" xf:continuous-sequence="true">

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

                       <fo:block background-color="rgb(51,204,204)">text here...text here</fo:block>

               </fo:flow>

       </fo:page-sequence>

       <fo:page-sequence master-reference="Sequence3" xf:continuous-sequence="true">

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

                       <fo:block background-color="rgb(204,153,255)">

                               <fo:table border-collapse="collapse" width="100%" table-layout="fixed">

                                       <fo:table-column column-width="25.000" column-number="1"/>

                                       <fo:table-column column-width="25.000" column-number="2"/>

                                       <fo:table-column column-width="25.000" column-number="3"/>

                                       <fo:table-column column-width="25.000" column-number="4"/>

                                       <fo:table-body>

                                               <fo:table-row>

                                                       <fo:table-cell border="1pt solid black" padding="2pt">

                                                               <fo:block>ID</fo:block>

                                                       </fo:table-cell>

                                                       <fo:table-cell border="1pt solid black" padding="2pt">

                                                               <fo:block>Product</fo:block>

                                                       </fo:table-cell>

                                                       <fo:table-cell border="1pt solid black" padding="2pt">

                                                               <fo:block>Delivered</fo:block>

                                                       </fo:table-cell>

                                                       <fo:table-cell border="1pt solid black" padding="2pt">

                                                               <fo:block>Client</fo:block>

                                                       </fo:table-cell>

                                               </fo:table-row>

                                               <fo:table-row>

                                                       <fo:table-cell border="1pt solid black" padding="2pt">

                                                               <fo:block>1</fo:block>

                                                       </fo:table-cell>

                                                       <fo:table-cell border="1pt solid black" padding="2pt">

                                                               <fo:block>Product 1</fo:block>

                                                       </fo:table-cell>

                                                       <fo:table-cell border="1pt solid black" padding="2pt">

                                                               <fo:block>07/25/2012</fo:block>

                                                       </fo:table-cell>

                                                       <fo:table-cell border="1pt solid black" padding="2pt">

                                                               <fo:block>Client A</fo:block>

                                                       </fo:table-cell>

                                               </fo:table-row>

                                               <fo:table-row>

                                                       <fo:table-cell border="1pt solid black" padding="2pt">

                                                               <fo:block>2</fo:block>

                                                       </fo:table-cell>

                                                       <fo:table-cell border="1pt solid black" padding="2pt">

                                                               <fo:block>Product 1</fo:block>

                                                       </fo:table-cell>

                                                       <fo:table-cell border="1pt solid black" padding="2pt">

                                                               <fo:block>07/26/2012</fo:block>

                                                       </fo:table-cell>

                                                       <fo:table-cell border="1pt solid black" padding="2pt">

                                                               <fo:block>Client B</fo:block>

                                                       </fo:table-cell>

                                               </fo:table-row>

                                       </fo:table-body>

                               </fo:table>

                       </fo:block>

               </fo:flow>

       </fo:page-sequence>

</fo:root>

 

 

Output:

 

continuous_sequence_how_to