Tab Extensions

Top Previous Topic Next Topic  Print this topic

This section describes extensions used to set the tab value needed while working with a document.

 

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"> (1) <xf:defaultTabStop val="2in"/> (2)

  <fo:layout-master-set>

       <fo:simple-page-master master-name="all-pages" page-width="8.5in" page-height="3in">

               <fo:region-body region-name="xsl-region-body" margin="0.7in" column-gap="0.25in" padding="6pt"/>

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

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

       </fo:simple-page-master>

       <fo:page-sequence-master master-name="default-sequence">

               <fo:repeatable-page-master-reference master-reference="all-pages" />

       </fo:page-sequence-master>

  </fo:layout-master-set>

  <fo:page-sequence master-reference="default-sequence">

       <fo:static-content flow-name="xsl-region-before" font-family="Times New Roman" font-size="12pt">

               <fo:block>&#x00A0;</fo:block>

       </fo:static-content>

       <fo:static-content flow-name="xsl-region-after" font-family="Times New Roman" font-size="12pt">

               <fo:block>&#x00A0;</fo:block>

       </fo:static-content>

       <fo:flow flow-name="xsl-region-body" font-family="Times New Roman" font-size="12pt">

               <fo:block font-size="14" color="red">

               <xf:tabstops> (3)

                       <xf:tabstop pos="1in"></xf:tabstop> (4)

                       <xf:tabstop pos="3in"></xf:tabstop>

                       <xf:tabstop pos="4in"></xf:tabstop>

               </xf:tabstops>

               <fo:inline font-size="100pt">t<xf:tab/>o<xf:tab/>t<xf:tab/>o</fo:inline></fo:block> (5)

               <fo:block text-decoration="underline" font-size="14" color="blue">        

               <xf:tabstops>

                       <xf:tabstop pos="96px"></xf:tabstop>

                       <xf:tabstop pos="2in"></xf:tabstop>

                       <xf:tabstop pos="5in"></xf:tabstop>

               </xf:tabstops>

               <fo:inline font-size="100pt">t<xf:tab/>o<xf:tab/>t<xf:tab/>o</fo:inline></fo:block>        

               <fo:block font-size="14" color="green">        

               <fo:inline font-size="100pt">t<xf:tab/>o<xf:tab/>t<xf:tab/>o</fo:inline></fo:block>                        

       </fo:flow>

  </fo:page-sequence>

</fo:root>

 

 

Key observations:

 

(1)  In order to work with these extensions, the corresponding xml namespace must be defined.

(2) xf:defaultTabStop defines working with tabs; val="2in" sets the default tab value.

(3)  xf:tabstops overrides the default tab values for the fo:block where it is defined.

(4) xf:tabstop is used to set the new tab values using the pos attribute and its value can be introduced in pixels or inches. Every time a tab is used, the cursor jumps to the values defined for pos.

(5) xf:tab is the extension used to insert the tab in the fo:block.

 

 

Output:

tab-stops

 

Also, xf:tabstop supports the xf:pattern attribute, that can have the following values:

·none
·dot
·hyphen
·underscore

 

This attribute determines the text/character used for tab stops.

 

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">

       <fo:layout-master-set>

               <fo:simple-page-master master-name="all-pages" page-width="8.5in" page-height="3in">

                       <fo:region-body padding="6pt" margin="0.7in" region-name="xsl-region-body"/>

               </fo:simple-page-master>

               <fo:page-sequence-master master-name="default-sequence">

                       <fo:repeatable-page-master-reference master-reference="all-pages"/>

               </fo:page-sequence-master>

       </fo:layout-master-set>

       <fo:page-sequence master-reference="default-sequence">

               <fo:flow flow-name="xsl-region-body" font-size="14pt">

                       <fo:block>Custom tab stop at "6.5in"</fo:block>

                       <fo:block background-color="yellow"><xf:tabstops>

                                       <xf:tabstop pattern="dot" pos="5in" val="center"/>

                               </xf:tabstops>

                       Text<xf:tab/>here</fo:block>

               </fo:flow>

       </fo:page-sequence>

</fo:root>

 

 

 

Output:

 

tabstop-pattern