Hide the whole empty row of table in VF page when rendered as pdf

I am showing object fields by using <table>,<tr> and <td> tags in page to show the details in some format. I am using following condition to show data on the page, if field is not blank

<tr>
<td><apex:outputLabel rendered="if field is not blank"><td> 
</tr>

In this code, if field is blank data is not visible but that row is generated and I am getting blank row between two rows.

How to remove this row dynamically?

Answer

I tend to do this directly in HTML with some CSS hackery

<tr style="display: {!IF(ISBLANK(Field__c), 'none', 'table-row')};">
    <td>Content of your cell</td>
</tr>

Attribution
Source : Link , Question Author : Rahul Nagardalekar , Answer Author : pjcarly

Leave a Comment