Thursday, 23 November 2017

How to add page number in Qweb reports in odoo

In this tutorial we will add page number in Qweb reports. But remember the page number only shows when the report type is PDF, In HTML format page number will not shown. Here we will display page number in this (page X of Y) format. In my case I am not using external_layout_footer in my reports. I instead have using footer class (class="footer").

<!--Report Body Section Goes Here-->
<div class="footer" style="position:absolute; margin:0px; padding:0px">
    <span class="page"/>/<span class="topage"/>
</div>    
 

Code Description

Here we uses footer class instead of external_layout_footer. And to display page numbers we used page and topage class. The output format of above code will be like this (1/2, 2/2) If you want to show page number in this format (1 of 2, 2 of 2) the use below code snippet. This will display page number at right side of the footer of the report.

       
<div class="footer" style="position:absolute; margin:0px; padding:0px">
   <span class="page"/> of <span class="topage"/>
</div>       
 


3 comments: