To get this to work as described in the comments from within the document template you will have to include the headers in the Template Grid itself, unlike when displaying the same data in a "regular" (Mendix) page. As in the latter situation the view is always on "Page 1" where the headers are, but the template grid can be seen as a sub-page in this context. Or in other words, paging in the template grid does not affect the page on which the headers are shown. This is not the case in a "Document template" where the concept of sub-pages (i.e. nesting) does not exist so paging in the template grid does affect the page on which the headers are shown.