1

Searched nearly one day but could'nt find the solution for this. There are lot of questions regarding word-wrap is not working on pdf but none of them have answers.

am just fetching the contacts email like below

<td>{!Contact.Email__c}</td>

Problem : Whenever the contact email is large/big one then it should break the line.

Used all those css properites like word-wrap, overflow, break-word, white-space.... but no use of these.

Somewhere I found that CSS3 properties are not supported by PDF generating engine.

Any solution for this?

Thanks in Advance!

  • I think its the email as a continuous string without spaces that will prevent you from wrapping, all of the css will be ignored because it doesn't know where to wrap. I think your only option is to clip the content to a max-width using overflow: hidden; – Phil Hawthorn Nov 19 '15 at 13:22
  • 1
    Also, css3 won't work with VF PDF, it is only css2 compliant – Phil Hawthorn Nov 19 '15 at 13:22
  • No use of hidden property. Also i dont want to clip. – mohammed azarudeen Nov 19 '15 at 13:35
  • If text is hidden then we can't see the text – mohammed azarudeen Nov 20 '15 at 7:07
2

In case of plain text,you can use \r\n.You can try using a VisualForce component

Component(Develop->Visualforce components):Add the following

 <apex:component controller="break" access="global" >

<apex:outputText value="{!break}" />

Controller:In classes

public class break {

public String break {

    get { return '\r\n'; }

    set;

}

And use the component's id in visualforce page:

<apex:repeat value="{!Contact.Email__c}" var="c">

    <apex:outputText value="{!c.ID}" />

    <c:break /> 

  • tried, not working @Pri – mohammed azarudeen Nov 19 '15 at 10:45
  • Try the above method. – Priyalakshmi Nov 19 '15 at 11:39
  • i don't know how to use apex:component. Could you show me the vf page with all the components(apex:component and apex:repeat) inside apex:page – mohammed azarudeen Nov 19 '15 at 12:16
  • I have modified the above answer for your understanding.Check whether you can get anything from it. – Priyalakshmi Nov 19 '15 at 13:21
  • Unknown constructor 'break.break(ApexPages.StandardController controller)' – mohammed azarudeen Nov 19 '15 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.