1
<apex:panelGrid columns="4" width="100%" columnClasses="random" >
<apex:repeat value="{!ProcessCellValuesWithoutName}" var="strCellValue">

<apex:outputLabel rendered="{!(!strCellValue.renderLink)}">{!strCellValue.recValues}</apex:outputLabel>
<apex:outputLabel rendered="{!(!strCellValue.renderLink)}">&nbsp;&nbsp;&nbsp;</apex:outputLabel>

</apex:repeat>
</apex:panelGrid>

I have tried adding style class to outputlabel and use the css properties like word-break:break-word/break-all , but that does not seem to wrap the column text when its too long to the next line and maintain the table width.

0

1 Answer 1

0

You'll need to put the labels inside an apex:outputPanel in order to render the cells needed for proper wrapping to take place.

<apex:panelGrid columns="4" width="100%" columnClasses="random">
    <apex:repeat value="{!ProcessCellValuesWithoutName}" var="strCellValue">

        <apex:outputPanel rendered="{!(!strCellValue.renderLink)}">
            {!strCellValue.recValues}
        </apex:outputPanel>
        <apex:outputPanel rendered="{!(!strCellValue.renderLink)}">
            &nbsp;&nbsp;&nbsp;
        </apex:outputPanel>

    </apex:repeat>
</apex:panelGrid>

This is because labels are inline elements, but you need tr and td elements for the table to render properly. If you need additional formatting, do so inside the apex:outputPanel elements.

2
  • Thanks a lot sfdcfox ! That works. But the same css does not work when the page is rendered as pdf using the renderAs="pdf" attribute on <apex:page> Jul 2, 2020 at 7:27
  • @paritoshparimal Make sure the styles are in the <head> tag, not the body, and are properly formatted. The CSS renderer in the PDF mode is kind of a pain to work with, as it doesn't support many common styles and properties.
    – sfdcfox
    Jul 2, 2020 at 12:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .