WRAP Option wrap the word before it exceeds the length
<p>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.</p>

<pre><code>&lt;fo:table width="33%" table-layout="fixed" position="fixed" margin-top="-21.5%" margin-left="68.5%"&gt; 
  &lt;fo:table-body&gt; 
    &lt;fo:table-row&gt; 
      &lt;fo:table-cell padding-bottom="3px" text-align="left" width="5cm" margin-left="1.2cm"&gt; 
        &lt;fo:block-container&gt; 
          &lt;fo:block wrap-option="wrap"&gt; 
            &lt;fo:inline font-family="TimesNewRoman" font-weight="bold"&gt; 
              &lt;xsl:value-of select="test/test1"/&gt; 
            &lt;/fo:inline&gt; 
          &lt;/fo:block&gt; 
        &lt;/fo:block-container&gt; 
      &lt;/fo:table-cell&gt; 
    &lt;/fo:table-row&gt; 
  &lt;/fo:table-body&gt; 
&lt;/fo:table&gt;
</code></pre>

<p>For example : I have a string like below :</p>

<pre><code> TEST 1 TEST 2 TEST 3
</code></pre>

<p>When i generate the PDF using above XSLT, it is displaying like below</p>

<pre><code> TEST
 1
 TEST
 2
 TEST
 3
</code></pre>

<p>Eventhough, it has more width, it is splitting and displaying.</p>

<p>How i would like to display is</p>

<pre><code>TEST 1 TEST ..if length exceeds the length
2 TEST 3
</code></pre>

<p><a href="https://i.stack.imgur.com/egC12.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/egC12.png" alt="enter image description here"></a></p>

<p>Can anyone help me on this?</p>