Skip to content

Instantly share code, notes, and snippets.

@joseph-montanez
Created January 7, 2017 08:52
Show Gist options
  • Save joseph-montanez/9546b4d2d32a670db08c4001fe1fbedd to your computer and use it in GitHub Desktop.
Save joseph-montanez/9546b4d2d32a670db08c4001fe1fbedd to your computer and use it in GitHub Desktop.
How to add tilted header columns to Apache FOP 2.1
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
<fo:layout-master-set>
<fo:simple-page-master master-name="first"
margin-right="1.5cm"
margin-left="1.5cm"
margin-bottom="2cm"
margin-top="1cm"
page-width="21cm"
page-height="29.7cm">
<fo:region-body margin-top="1cm"/>
<fo:region-before extent="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="first">
<fo:flow flow-name="xsl-region-body">
<fo:block space-before.optimum="30pt" space-after.optimum="15pt">
Table 8: This is a table with border properties (border-style,
border-width, border-color) defined at the fo:table-column and
fo:table-row level. Not all properties are currently
implemented--check the compliance page on the FOP website for current
implementation status.
</fo:block>
<fo:table border-collapse="collapse" table-layout="fixed" width="100%" space-before.optimum="3cm">
<fo:table-column column-width="3cm" border-color="black" border-width="0.5pt" border-style="solid"/>
<fo:table-column column-width="3cm" border-color="black" border-width="0.5pt" border-style="solid"/>
<fo:table-column column-width="3cm" border-color="black" border-width="0.5pt" border-style="solid"/>
<fo:table-header font-weight="regular" border="0pt solid black">
<fo:table-row border="none">
<fo:table-cell>
<fo:block-container position="absolute" fox:transform="rotate(-45)" left="1.5cm" top="-0.5cm">
<fo:block text-align="center">
Joseph
</fo:block>
</fo:block-container>
<fo:block-container position="absolute" fox:transform="rotate(-45)" left="-0.1mm" top="0mm" width="3cm">
<fo:block border-bottom-width="0.5pt" border-bottom-style="solid"></fo:block>
</fo:block-container>
<fo:block-container position="absolute" fox:transform="rotate(-45)" left="2.985cm" width="3cm" top="0mm">
<fo:block border-bottom-width="0.5pt" border-bottom-style="solid"></fo:block>
</fo:block-container>
</fo:table-cell>
<fo:table-cell>
<fo:block-container position="absolute" fox:transform="rotate(-45)" left="1.5cm" top="-0.5cm">
<fo:block text-align="center">
Misty
</fo:block>
</fo:block-container>
<fo:block-container position="absolute" fox:transform="rotate(-45)" left="2.985cm" width="3cm" top="0mm">
<fo:block border-bottom-width="0.5pt" border-bottom-style="solid"></fo:block>
</fo:block-container>
</fo:table-cell>
<fo:table-cell>
<fo:block-container position="absolute" fox:transform="rotate(-45)" left="1.5cm" top="-0.5cm">
<fo:block text-align="center">
Andres
</fo:block>
</fo:block-container>
<fo:block-container position="absolute" fox:transform="rotate(-45)" left="2.985cm" width="3cm" top="0mm">
<fo:block border-bottom-width="0.5pt" border-bottom-style="solid"></fo:block>
</fo:block-container>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row border-color="black" border-width="0.5pt" border-style="solid" border-top="none">
<fo:table-cell>
<fo:block text-align="center">
(1,1)
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="center">
(1,2)
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="center">
(1,3)
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row border-color="black" border-width="0.5pt" border-style="solid">
<fo:table-cell>
<fo:block text-align="center">
(2,1)
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="center">
(2,2)
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="center">
(2,3)
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row border-color="black" border-width="0.5pt" border-style="solid">
<fo:table-cell>
<fo:block text-align="center">
(3,1)
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="center">
(3,2)
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="center">
(3,3)
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment