Main Content

mlreportgen.report.ReportLayout class

Package: mlreportgen.report

Page layout of report

Description

Use an object of the mlreportgen.report.ReportLayout class to specify report page layout options, such as watermarks, first page numbering, page number formatting, page size and orientation, and margins.

Note

A report creates an instance of this class and assigns it to the mlreportgen.report.Report Layout property. You do not create the object yourself.

The mlreportgen.report.ReportLayout class is a handle class.

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Properties

expand all

Watermark image for the report pages, specified as [] or a character vector or string scalar that contains the image path name. The specified watermark appears on all pages of the report. An empty value, [], indicates that no watermark is used. To use a different watermark for an individual report section, such as a chapter, set the Watermark property of the mlreportgen.report.ReporterLayout object used by the section reporter. Valid image types are:

  • .bmp

  • .jpg

  • .pdf (for PDF output types only)

  • .png

  • .svg

  • .tiff

Number to use on the first page of each section in the report, specified as [] or a positive integer. For example, if you set the first page number for the report to 4, the first page number for every report chapter is 4. To use a different first page number for an individual section, set the FirstPageNumber property of the mlreportgen.report.ReporterLayout object used by the section reporter. The default numbering for the report is [], which indicates that the first page of chapter 1 is page 1. All subsequent pages in the report are numbered sequentially.

Type of page numbering to use for the report, specified as a string scalar or character vector. The specified page number format appears on all pages of the report. To use a different page number format for an individual section, such as a chapter, set the PageNumberFormat property of the mlreportgen.report.ReporterLayout object used by the section reporter. See the Format property in mlreportgen.dom.PageNumber for a list of valid page number formats.

Page orientation for the report, specified as true or false. Set this property to true to change portrait orientation to landscape orientation and false to change landscape orientation to portrait orientation. If the value is [], the orientation is determined by the page size specified by the report layout.

Size of pages in the report, specified as an mlreportgen.dom.PageSize object.

Sizes of page margins, header, footer, and gutter in the report, specified as an mlreportgen.dom.PageMargins object.

Examples

collapse all

Set the page number format for the whole report to Arabic numbers and the page number for the table of contents to Roman numerals. The chapters use the Arabic number format, which is the default format for the whole report. The first page of the first chapter defaults to 1.

import mlreportgen.report.*
rpt = Report('newreport'); 
rpt.Layout.PageNumberFormat = 'n';

tp = TitlePage();
tp.Title = 'New Report'; 
tp.Author = 'MathWorks'; 
append(rpt,tp);

toc = TableOfContents();
toc.Layout.PageNumberFormat = 'i';
append(rpt,toc);

ch = Chapter();
ch.Title = 'Introduction';
sec = Section('First Section of Chapter 1');
txt = ['This is the first section of chapter 1. ',...
      'The page number format is Arabic numbers, ',...
      'which is the default for the report.'];
append(sec,txt);
append(ch,sec);
append(rpt,ch); 

ch = Chapter(); 
ch.Title = '2nd chapter';
sec = Section('First Section of Chapter 2'); 
txt = ['This is the first section of chapter 2. ',...
      'The page number format is Arabic numbers, ',...
      'which is the format defined for the report.'];
append(sec,txt);
append(ch,sec);
append(rpt,ch);

close(rpt);
rptview(rpt);
Introduced in R2017b