Mick Farmer wrote:
I have a <fo:list-block> which I would like centered
(i.e. equal left and right margins) on the page.  The
text-align attribute centers each individual line, but
that's not what I want.

The more obvious solutions (fo:inline-container et al.) do not yet work with FOP. There is still the big gun: a blind table.

Approach: use a table with three columns. The middle column gets the
width the list block should have (if there is no explicit width, there
is no point in centering it). The other two columns should be of the
same width, that's what proportional-column-width is for.
Result:

  <fo:table table-layout="fixed" width="100%">
   <fo:table-column column-width="proportional-column-width(1)"/>
   <fo:table-column column-width="100mm"/>
   <fo:table-column column-width="proportional-column-width(1)"/>
   <fo:table-body>
     <fo:table-row>
       <fo:table-cell/>
       <fo:table-cell  border-width="1pt" border-style="solid">
         <fo:list-block provisional-distance-between-starts="1cm">
           <fo:list-item>
             <fo:list-item-label end-indent="label-end()">
               <fo:block>1.</fo:block>
             </fo:list-item-label>
             <fo:list-item-body start-indent="body-start()">
                <fo:block>Lorem Ipsum</fo:block>
             </fo:list-item-body>
           </fo:list-item>
         </fo:list-block>
       </fo:table-cell>
       <fo:table-cell/>
     </fo:table-row>
   </fo:table-body>
 </fo:table>

 J.Pietschmann



Reply via email to