Chapter reporter


Create a chapter reporter that adds a chapter to the report. This class inherits from


ch = Chapter() creates a reporter that generates a chapter. The chapter has a new page layout defined by the default template of the reporter.

The default template is a portrait page with a header and a footer. The header is empty. If a chapter is the first chapter of the report, the footer contains an automatically generated page number that starts with 1. If it is not the first chapter, the page numbering continues from the last page of the previous chapter. Use the Layout property to override some of the page layout features of the chapter, such as its orientation.

To add content to the chapter, use the method.


Before you add a chapter to a report, add all the content that you want into that chapter. Once you add that chapter to a report (add(report,chapter)), you cannot add more content to that chapter.

ch = Chapter(title) creates a report chapter containing a chapter title with the specified title text.

ch = Chapter(Name,Value) sets properties using name-value pairs. You can specify multiple name-value pair arguments in any order. Enclose each property name in single quotes.

Input Arguments

expand all

Chapter title, specified as a string or character array. The title appears at the beginning of the chapter and in the header of all chapter pages except the first page. The title also appears in the table of contents of the report. The title is numbered by default.

To turn off numbering for this chapter, use the Numbered property of the chapter. To turn off numbering for this and all other chapters in the report, use the method.

If numbered, the title is prefixed in English reports by a string in the form Chapter N., where N is the automatically generated chapter number. In some other locales, the English prefix is translated to the language of the locale. See the Locale property of for a list of translated locales.


expand all

A chapter reporter is a type of section reporter and inherits its properties. The Layout property is the only property that is not inherited from

Layout of this chapter, specified as an object. Use Layout to override some of the chapter layout properties, which are defined in the template for the chapter. First page number and page orientation are examples of chapter layout properties. See

Example: chapter.Layout.Landscape = true


A chapter reporter is a type of section reporter and inherits its methods. See for descriptions of the methods.

Inherited Methods

add Add section content
createTemplateCreate section template
customizeReporter Create custom section reporter class
getClassFolderSection class definition file location
getTitleReporter Get section title reporter
numberSet section numbering
customizeReporterCreate class derived from Reporter class
getImpl Get implementation of reporter

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects (MATLAB).


Add a Chapter and Set Its Page Orientation

Add a chapter to the report. Set its layout orientation to landscape. Add a section to that chapter.

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', ...


Introduced in R2017b