Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mlreportgen.report.Chapter class

Package: mlreportgen.report
Superclasses:

Chapter reporter

Description

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

Construction

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 mlreportgen.report.Chapter.add method.

Note

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 mlreportgen.report.Section.number 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 mlreportgen.report.Report for a list of translated locales.

Properties

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 mlreportgen.report.Section.

Layout of this chapter, specified as an mlreportgen.report.ReporterLayout object. Use Layout to override some of the chapter layout properties, which are defined in the template for the chapter. Page orientation is one example of a chapter layout property. See mlreportgen.report.ReporterLayout.

Example: chapter.Layout.Landscape = true

Methods

A chapter reporter is a type of section reporter and inherits its methods. See mlreportgen.report.Section 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
getImpl Get implementation of reporter

Copy Semantics

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

Examples

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.report.*
import mlreportgen.dom.*
report = Report('My Report','pdf');
add(report,TitlePage('Title','My Report'));
chapter = Chapter('Images');
chapter.Layout.Landscape = true;
add(chapter,Section('Title','Boeing 747', ...
     'Content',Image(which('b747.jpg'))));
add(report,chapter);
close(report);
rptview(report);

Introduced in R2017b

Was this topic helpful?