Reputation: 103
I am generating the PDF using Apache FOP. I want to wrap the text if and only if exceeds the table-cell length. I tried with wrap-option="wrap". It splits the word when it finds the space itself.It does not look at the length of table-cell exceeds or not.
<fo:table width="33%" table-layout="fixed" position="fixed" margin-top="-21.5%" margin-left="68.5%">
<fo:table-body>
<fo:table-row>
<fo:table-cell padding-bottom="3px" text-align="left" width="5cm" margin-left="1.2cm">
<fo:block-container>
<fo:block wrap-option="wrap">
<fo:inline font-family="TimesNewRoman" font-weight="bold">
<xsl:value-of select="test/test1"/>
</fo:inline>
</fo:block>
</fo:block-container>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
For example : I have a string like below :
TEST 1 TEST 2 TEST 3
When i generate the PDF using above XSLT, it is displaying like below
TEST
1
TEST
2
TEST
3
Eventhough, it has more width, it is splitting and displaying.
How i would like to display is
TEST 1 TEST ..if length exceeds the length
2 TEST 3
Can anyone help me on this?
Upvotes: 0
Views: 3486
Reputation: 8068
Add start-indent="0pt"
on fo:table-body
:
<fo:table width="33%" table-layout="fixed"
position="fixed" margin-top="-21.5%" margin-left="68.5%">
<fo:table-body start-indent="0pt">
<fo:table-row>
<fo:table-cell padding-bottom="3px" text-align="left" width="5cm">
<fo:block>
<fo:inline font-family="TimesNewRoman" font-weight="bold"
> TEST 1 TEST 2 TEST 3 </fo:inline>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
The fo:table/@margin-left
was setting the inherited start-indent
value that is used when working out the start-indent
trait for the contents of each fo:table-cell
. See https://www.w3.org/TR/xsl11/#refine-margin-space-indent for details.
Also, the fo:table-cell/@margin-left
, the fo:block-container
, and the fo:block/@wrap-option
weren't adding anything.
Upvotes: 1