1

I have a page that I am rendering as a pdf. The label and the value are right on top of each other. How do I get spaces between them? The critical line is:

<apex:outputField label="{!f.pdfLabel}" value="{!evalForm[f.fieldMember]}" style="white-space:pre" />

I have tried it with and without label=. I have added spaces to the f.label value in the controller to no avail. Does anyone know how to display some whitespace between the label and value? I cannot use outputtext because some fields are ids, and I need the name not the id displayed.

Thanks.

  • Do you want them to appear in two lines with a line of space between them or in one line with whitespace? – Rosh Aug 5 '13 at 4:08
1

I would try several possible solutions:

Just divide output field into the label/value:

<apex:pageBlockSectionItem>
    <apex:outputLabel value="{!testacc.Name}" style="margin-right:5px;" />
    <apex:outputField value=" {!testacc.Name}"/>
</apex:pageBlockSectionItem>

Or use outputText:

<apex:outputText label="{!f.pdfLabel}" 
                  value="{!' '+evalForm[f.fieldMember]}" 
                  style="white-space:pre" />

Or

<apex:outputText label="{!f.pdfLabel}" 
                  value=" {!evalForm[f.fieldMember]}" 
                  style="white-space:pre" />
|improve this answer|||||
  • Thanks for your help. The first option outputs the label twice (outputField gives the label and the field). The second and third display the id and not the name because they use outputtext. Is there a way to suppress the label for outputField so I could use your first option? – JimH Aug 5 '13 at 11:04
  • OK, so I used pageBlocksectionitem and got rid of the second label. Thanks so much for your help. – JimH Aug 5 '13 at 11:24

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.