Main Content

mlreportgen.report.ReportLayout Class

Namespace: 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, specified as [] or as a character vector or string scalar that contains the image path name. The watermark appears on all pages of the report section. If the Watermark property is [], the watermark for the section is the same as the watermark for the report. If the Watermark property of the layout objects for the report section and the report are [], no watermark appears.

Valid image types are:

  • .emf

  • .gif

  • .jpg

  • .pdf

  • .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.

Data Types: double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Type of page numbering to use for the report, specified as a character vector or string scalar. 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.

Data Types: char | string

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.

Data Types: logical

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

Attributes:

NonCopyable
true

Sizes of the margins, header, footer, and gutter for this page layout, specified as an mlreportgen.dom.PageMargins object.

Attributes:

NonCopyable
true

Page borders for layout, specified as an mlreportgen.dom.PageBorder object.

Attributes:

NonCopyable
true

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);

Version History

Introduced in R2017b

expand all