You need to sign in to do that
Don't have an account?

Wordwrap is not working in table in Visualforce PDF
Hi Guys,
I developed one table in which each row(tr) has 3 td's. Here if i use more lengthy word in one td, the word is not getting into next line. I used wordwrap and overflow but not working in PDF. Please help me out this problem and observe bold words.
Sample Code:
<table style="width:90%;margin-left:5%;margin-right:5%;page-break-after:always;border:1px solid black;word-break: break-all;" cellspacing="0">
<tr style="width:100%;border:1px solid black;">
<td style="width:20%;text-align:center;border:1px solid black;word-break: break-all;table-layout:fixed;">
<apex:outputlabel style="word-break: break-all;">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</apex:outputlabel>
</td>
<td style="width:20%;text-align:center;border:1px solid black;">
<apex:outputlabel >XXXXXXXXXXXX</apex:outputlabel>
</td>
<td style="width:60%;text-align:left;border:1px solid black;"><!------word-wrap: break-word;word-break:break-all;------->
<table style="width:100%;">
<tr>
<td>
<ul style="list-style-type:dots;">
<li>
<apex:outputlabel style="overflow-wrap: break-word;">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXX</apex:outputlabel>
</li>
<li>
<apex:outputlabel style="word-break:keep-all;">XXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX</apex:outputlabel>
</li>
</ul>
</td>
</tr>
</table>
</td>
</tr>
</table>
I developed one table in which each row(tr) has 3 td's. Here if i use more lengthy word in one td, the word is not getting into next line. I used wordwrap and overflow but not working in PDF. Please help me out this problem and observe bold words.
Sample Code:
<table style="width:90%;margin-left:5%;margin-right:5%;page-break-after:always;border:1px solid black;word-break: break-all;" cellspacing="0">
<tr style="width:100%;border:1px solid black;">
<td style="width:20%;text-align:center;border:1px solid black;word-break: break-all;table-layout:fixed;">
<apex:outputlabel style="word-break: break-all;">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</apex:outputlabel>
</td>
<td style="width:20%;text-align:center;border:1px solid black;">
<apex:outputlabel >XXXXXXXXXXXX</apex:outputlabel>
</td>
<td style="width:60%;text-align:left;border:1px solid black;"><!------word-wrap: break-word;word-break:break-all;------->
<table style="width:100%;">
<tr>
<td>
<ul style="list-style-type:dots;">
<li>
<apex:outputlabel style="overflow-wrap: break-word;">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXX</apex:outputlabel>
</li>
<li>
<apex:outputlabel style="word-break:keep-all;">XXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX</apex:outputlabel>
</li>
</ul>
</td>
</tr>
</table>
</td>
</tr>
</table>
-
just wrapping the elements containing text in a div and set the word-wrap attribute there.Given your code sample I'd try to design it this way (forgive the spacing :) ). This should work for you.
Full VF markup:
This is what the result looks like...
http://www.screencast.com/t/br0Lfe4l
Side note:
These (
sidebar="false" showHeader="false" standardStylesheets="false" ) do not have to be false, it should work either way.. I just used that for this example