7

I would like to as you how to repeat table header ( thead) for each page on the top ?? the simple code is like this :

</messaging:htmlEmailBody> 
    <messaging:attachment renderAs="pdf" filename="{!relatedTo.Name}.pdf">
        <html>
            <body>
                <table border="1">
                   <thead>
                       <tr>
                           <th>Head 1</th>
                           <th>Head 2</th>
                       </tr>
                   </thead>
                   <tbody>
                       <tr>
                           <td>value 1</td>
                           <td>value 2 </td>
                       </tr>
                       <tr>
                           <td>value 3</td>
                           <td>value 4</td>
                       </tr>
                   </tbody>
               </table>
            </body>
        </html>
    </messaging:attachment>
</messaging:emailTemplate>

so according this example , I would like to reapeat ( Head 1 and Head 2) at the beginning of each page . I test this code but it doesn't work :

@page {
    thead {
        display: table-header-group;
    }
}

I tested thead {display: table-header-group;}but it doesn't work

an idea ??

thanks

2 Answers 2

11

Inside your CSS in tables style tag, you need to add the following attribute:

table {
    -fs-table-paginate: paginate;
}

puts a header at the start of each new page where a table crosses a page boundary.

The -fs reportedly refers to Flying Saucer, the render engine used by SF to create PDFs and is specific to that render engine (not for use elsewhere).

1
  • Yes, Flying Saucer is indeed used by SF to create the PDFs. I don't remember where I read this, but I've had to look at the FS manual on more than one occasion to get some obscure CSS trick to work just right.
    – sfdcfox
    Commented Jul 10, 2015 at 22:05
-1

Please use this code its help you

thead, tfoot {
    display: table-row-group
}

You must log in to answer this question.

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