Main Content

Generate a Report API Report with Page Borders

This example uses the Report API to generate a Word or PDF report that has red page borders on the title page and blue page borders on the other sections of the report.

Import the Report API and DOM API packages so that you do not have to use long, fully qualified class names.

import mlreportgen.dom.*;

Create a Word report and specify solid, blue, 0.5-point default borders for all pages of the report. For a PDF report, replace "docx" with "pdf".

rpt = Report("myreport","docx");
rpt.Layout.PageBorder = PageBorder("solid","blue","0.5pt");

Create a title page and specify solid, red, 0.5-point borders for the title page. Append the title page to the report.

tp = TitlePage("Title","My Report");
tp.Layout.PageBorder = PageBorder("solid","red","0.5pt");

Create a chapter and append it to the report.

ch = Chapter("My Chapter");

Close and view the report.


In the generated report, the title page has red borders as specified by the title page reporter layout.


The chapter pages have the default blue borders because the chapter reporter layout did not specify page borders.


See Also

| | | |

Related Topics