Main Content

Create Chapters

You can add chapters to your report using the class. It is much easier and more efficient to use this class rather than using DOM objects to create a chapter. The Chapter class inherits from Chapter class automatically adds a formatted chapter into your report. The default formatting is portrait orientation with a header and a footer. The footers includes the page number. You can override the layout of the chapter.

For information and examples, see

This example shows code that creates a title page and sets its page orientation to landscape.

Run the following command to access the supporting files used in this example.

import mlreportgen.dom.*

rpt = Report('My Report','pdf');

add(rpt,TitlePage('Title','My Report'));

chapter = Chapter('Images');
chapter.Layout.Landscape = true;
add(chapter,Section('Title','Boeing 747', ...


Chapter one with a picture of a Boeing 747