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
srinivasusrinivasu 

how to have a column headervalue to appear in all pages when rendered as pdf?

Hi,

 

I am working on a report to be generated in pdf format.

I have to display the column header values in all the pages. Is it possible to handle this in visualforce.

 

The code is somewhat like this which i am trying. I want the apex:column headerValue="Primary Name"  to appear in all the pages when rendered as pdf.Currently only in the first page the header is coming with values  and in the following pages the values are coming with no header. Is it possible to display the header in all pages in an aligned manner.

 

 

<apex:page renderAs="pdf" standardStylesheets="false">
<head>
<style>

@page :first
{

margin : 70pt .5in .7in .5in;
size:landscape;
@top-right
{
        content : element(header);
}
@top-left {
     font-family:Arial;font-size:16pt;font-weight:bold;
     content: "Relationship";
        }
          @bottom-left {
        font-family:Arial;font-size:10pt;
        content : element(footer);
    }

         
            @bottom-right {
   
    font-family:Arial;font-size:10pt;
    content: "Page " counter(page) " of " counter(pages);
      
    }


}

@page
{

margin : 70pt .5in .7in .5in;
size:landscape;
@top-right
{
        content : element(header);
}
@top-left {
     font-family:Arial;font-size:16pt;font-weight:bold;
     content: "Relationship all";
        }
       
        @top-center
{
content: element(test1);
}
       

       
          @bottom-left {
        font-family:Arial;font-size:10pt;
        content : element(footer);
    }

         
            @bottom-right {
   
    font-family:Arial;font-size:10pt;
    content: "Page " counter(page) " of " counter(pages);
      
    }


}


div.header {
    position : running(header) ;
}
div.footer {   
    position : running(footer) ;
}

div.test1
{
position: running(test1);
width:703px;
padding-left:9px;
}

.table1Value{color: #333333; font-size: 70%;text-align: center;border-bottom:0px double #605E5E;}
</style>


</head>

 


<div class="header" align='right'>
    <apex:image value="logo"/>
</div>

<div class="test1">
<table>
<tr >
<th width="10%" align="left">Relationship </th><th width="10%">AA</th><th width="10%">BB</th><th width="12%">CC</th><th width="10%">DD</th><th width="12%">EE</th><th width="10%">FF</th><th width="12%">GG</th>
</tr>
</table>
</div>


<div class="footer" align='left'>
    Date Printed  : {!MONTH(TODAY())}/{!DAY(TODAY())}/{!YEAR(TODAY())}<br/>

</div>

     <apex:column headerValue="Primary Name" style="font-family:Arial;font-size:10pt;">
     {!NULLVALUE(l.rg.households__PrimaryAccount__r.Name,'-')}
     </apex:column> 


</apex:page>

Navatar_DbSupNavatar_DbSup

Hi,
You can create a div which contains your header code which is running across the pdf.Use the below code snippet it would help you.
------------------ sample code --------------------------->


<style>
@page
{
margin-top: 15%;
@top-center
{
content: element(header1);
}
}
div.header1
{
position: running(header1);
width:703px;
padding-left:9px;
}
</style>
<div class="header1" id="logo" width="100%">
<table width="100%" id="logoTable" border="0">
<tr width="100%">
<td width="50%" height="60" ><apex:image url="{!url2}" id="logo11" height="60" width="100" rendered="{!display}"/></td>
<td width="50%" align="right" height="35"><apex:image url="{!url1}" id="logo21" height="35" width="150"/></td>
</tr>
<tr width="100%">
<td width="100%" colspan="2" height="0"></td>
</tr>
</table>
<table width="100%" class="tableHValue" border="0">
<tr valign="bottom">
<th width="15%" align="left">E.No</th><th width="12%">Name </th><th width="15%">Company</th>
</tr>
</table>
<br/><br/>
</div>

 

 

 Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

Rehan DawtRehan Dawt

Hi,

 

You can also add this CSS also which will work in your condition. This work perfectly.

 

<script>
.tableStyle
{
width: 100%;
-fs-table-paginate: paginate;
}
</script>

<table class="tableStyle">
<thead>

</thead>
<tbody>

</tbody>
</table>

 

Thanks,

Rehan Dawt.

miteshsuramiteshsura

 

Rehan,

 

You are my HERO !!! Can't beleive adding that one line of script does that magic. At first I was skeptical, because google won't even return any result when I search for -fs-table-paginate . 

 

Can you please pass some documentatoin for the tag ?

 

Tried in Chrome, does it work well in all browsers? 

 

regards

Mitesh

ISVPartner