To add custom text to a footer in your report, you can work with the 'DOCXPageFooter' class:
Documentation Page:
Example of making a footer:
When creating a page footer, you can first specify which pages you would like it to appear on (first page only, even pages, odd pages, or all pages). Then, you can append different DOM objects to the footer, such as a page number or a paragraph.
The following code is an adaptation of the example linked above. This code demonstrates how to add a paragraph with custom text to a footer which already includes the page number:
import mlreportgen.dom.*;
d = Document('mydoc','docx');
open(d);
myfooter = DOCXPageFooter();
d.CurrentPageLayout.PageFooters = [myfooter];
pageNum = Page();
append(d.CurrentPageLayout.PageFooters(1), pageNum);
txt = Paragraph('My custom text');
txt.HAlign = 'center';
append(d.CurrentPageLayout.PageFooters(1),txt);
p = Paragraph('Title page');
append(d,p);
p = Paragraph('Another page');
p.Style = {PageBreakBefore(true)};
append(d,p);
append(d,clone(p));
append(d,clone(p));
close(d);
rptview(d.OutputPath);
Best Answer