function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kris Ryan SAKris Ryan SA 

Rich Area Text formatting not correct when defaulting from another Rich Area Text

Hi,
We have an apex class that is defaulting information for a Visualforce page to send an email.
I have changed the class to pull the email signature from the user file. This is copying a rich text area field into another rich text area field.
This seems to work, shockingly, since I am not a coder. BUT there seems to be additional spacing on the visualforce page input.
Would someone be able to tell me how to fix this?

Apex Class code:
public PCharter(ApexPages.StandardController stdController) {
    this.ProjectCharter = (Project_Charter__c)stdController.getRecord();
    this.getProjectCharter();
    User u = [Select Id, Name, Email_Signature__c from User where Id =: UserInfo.getUserId()];
    this.ProjectCharter.Email_Message__c = u.Email_Signature__c;

Visualforce Page:
<p>Message:  <br /><apex:inputTextarea richtext="true" value="{!ProjectCharter.Email_Message__c}" rows="20"/></p>

Here is my email signature:
Email Signature from User record
This is what the field ends up looking like:
Email Message
See the additional line spacing? How can I make it look exactly like the email signature?

Thanks!!!
Ryan GreeneRyan Greene
I've had similar issues with VF Pags as a PDF. To solve for spacing I had to write CSS to style the doc. In the code below, edit the font size, font type, and line height to your liking.Try updating your VF Page like this:
<apex:page controller="YourController">
    <head>
        <style type="text/css">
            body {
            font-size:11pt;
            font-family:Arial, "Helvetica Neue", Helvetica, sans-serif;
            line-height:1.3;
            }
        </style>
    </head>
    <html>
        <body>
            <p>Message:  <br /><apex:inputTextarea richtext="true" value="{!ProjectCharter.Email_Message__c}" rows="20"/></p>
        </body>
    </html>
</apex:page>

 
Kris Ryan SAKris Ryan SA
Thanks, Ryan! I was playing around with the style for that field, but it did not work. I only tried line-height, though. I will try what you have.
Here is the whole output panel I currently have, which I should have included originally!
<body>
        <apex:outputPanel layout="block" styleClass="container">
            <apex:form >
                 <apex:outputpanel layout="block" id="logo" styleclass="col-md-3">
                    <apex:image title="YMCA Logo" url="{!URLFOR($Resource.DigitalAssets, 'Ylogo-aof-E-rgb_png/blu_rgb_png/ymca_blu_rgb_r.png')}" height="75px" />
                </apex:outputpanel><br/><br/><br/><br/>
                 <apex:outputpanel id="submit" layout="block" style="margin: 5px; padding: 5px;" >
                   <apex:outputpanel layout="block" styleClass="row" style="margin: 5px; padding: 5px;">
                        <p>CEO: <apex:inputField value="{!ProjectCharter.CEO__c}"/></p>
                        <p>CVO: <apex:inputField value="{!ProjectCharter.CVO__c}"/></p>
                        <p>Resource Director: <apex:inputField value="{!ProjectCharter.Resource_Director__c}"/></p>
                        <p>Alternate: <apex:inputField value="{!ProjectCharter.Alternate__c}"/></p>
                        <p>Message:  <br/><apex:inputTextarea richtext="true" style="line-height: 1" value="{!ProjectCharter.Email_Message__c}" rows="20"/></p>                       
                        <apex:commandlink styleClass="btn btn-primary" style="float: left; margin-right: 3px;" action="{!submit}" value="Send"/>
                        <apex:commandLink styleClass="btn btn-primary" style="float: left;width: 150px;" action="{!cancel}" value="Cancel" target="_self"/>
                   </apex:outputpanel>
                 </apex:outputpanel>   
            </apex:form>
        </apex:outputPanel>
    </body>