-1

I have below table in VF Page where the table data dows not fit as expected due to narrow width of the ms word type visualforce page.

Page code

   <table id="contacttable" style="table-layout:fixed;" >
                            <tr style="width:auto;overflow:hidden;"> 
                            <apex:repeat value="{!$ObjectType.Configuration__c.Fieldsets.Validation_Rule}" var="varFieldName" rendered="{!IF(key2 == 'Validation Rule', true, false)}"> 
                                <th style="position:absolute;width:auto;page-break-inside: avoid;background-color: #9e9494;border-width: thick thick;border: 1px solid black;margin:0px 0px 0px 0px;">{!varFieldName.Label}</th>
                            </apex:repeat>

                            <apex:repeat value="{!$ObjectType.Configuration__c.Fieldsets.Email_or_Alert}" var="varFieldName" rendered="{!IF(key2 == 'Email or Alert', true, false)}"> 
                                <th style="position:absolute;overflow-x:auto;page-break-inside: avoid;word-wrap: break-word;background-color: #9e9494;border-width: thick thick;border: 1px solid black;margin:0px 0px 0px 0px;">{!varFieldName.Label}</th>
                            </apex:repeat>

                            <apex:repeat value="{!$ObjectType.Configuration__c.Fieldsets.Change_Request}" var="varFieldName" rendered="{!IF(key2 == 'Change Request', true, false)}" > 
                                <th style="position:absolute;width:auto;page-break-inside: avoid;background-color: #9e9494;border-width: thick thick;border: 1px solid black;margin:0px 0px 0px 0px;">{!varFieldName.Label}</th>
                            </apex:repeat>

                            </tr>


                            <apex:repeat value="{!configMap[key1][key2]}" var="listElement">
                                <apex:repeat value="{!listElement}" var="listElementelements"  >
                            <tr style="width:50px;overflow:hidden;">
                                    <apex:repeat value="{!$ObjectType.Configuration__c.Fieldsets.Validation_Rule}" var="varFieldName" rendered="{!IF(key2 == 'Validation Rule', true, false)}">
                                        <td style="position:absolute;width:10px;page-break-inside: avoid;background-color: #ffffff;border-width: thick thick;border: 1px solid black;margin:0px 0px 0px 0px; ">{!listElementelements[varFieldName]}</td>   
                                    </apex:repeat>

                                    <apex:repeat value="{!$ObjectType.Configuration__c.Fieldsets.Email_or_Alert}" var="varFieldName" rendered="{!IF(key2 == 'Email or Alert', true, false)}">
                                        <td style="position:absolute;overflow-x:auto;page-break-inside: avoid;word-wrap: break-word;background-color: #ffffff;border-width: thick thick;border: 1px solid black;margin:0px 0px 0px 0px;">{!listElementelements[varFieldName]}</td>   
                                    </apex:repeat>

                                    <apex:repeat value="{!$ObjectType.Configuration__c.Fieldsets.Change_Request}" var="varFieldName" rendered="{!IF(key2 == 'Change Request', true, false)}">
                                        <td style="position:absolute;width:10px;page-break-inside: avoid;background-color: #ffffff;border-width: thick thick;border: 1px solid black;margin:0px 0px 0px 0px;">{!listElementelements[varFieldName]}</td>

                                    </apex:repeat>
                            </tr>
                                </apex:repeat>
                            </apex:repeat>

                        </table>

Can someone help me know where I do wrong?

Page looks like below.

enter image description here

2
  • May I know why this question got demoted? I am sorry but I need to know for my future references. Thanks! Commented Jul 3, 2018 at 7:54
  • You need to hardcode the table width as width in % will not have much affect here. Commented Jul 3, 2018 at 8:38

1 Answer 1

0

I just achieved what I wanted to using word-wrap: break-word; Please find below my changed code.

 <apex:repeat value="{!$ObjectType.XXXX.FieldSets.XX}" var="varFieldName" rendered="{!IF(key2 == 'XXX', true, false)}"> 
                                <th style="word-break: break-all;position:absolute;overflow-x:auto;page-break-inside: avoid;word-wrap: break-word;background-color: #9e9494;border-width: thick thick;border: 1px solid black;margin:0px 0px 0px 0px;">{!varFieldName.Label}</th>
                            </apex:repeat>

You must log in to answer this question.

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