Main Content

mlreportgen.report.ReporterLayout Class

Namespace: mlreportgen.report

Layout for reporter

Description

Use an object of the mlreportgen.report.ReporterLayout class to specify page layout options for a report section, such as a title page, table of contents, list of figures, list of tables, list of captions, or chapter. Page layout options include watermarks, first page numbering, page number formatting, page size and orientation, and margins.

Note

When you create the reporter for a report section, an instance of this class is created and assigned to the reporter Layout property. You do not create this object yourself.

The mlreportgen.report.ReporterLayout 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 the report section, specified as an integer or []. If the value of this property is -1 or [], the numbering is continued from the previous section. To specify the first page number, enter a positive integer.

Note

By default, the number of the first page of the first chapter is 1.

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

Add three chapters to a report. The first chapter uses default values for the first page number, which is 1 and the default page orientation, which is portrait. The second chapter resets the first page number to 1 and uses landscape page orientation. The page number and orientation are not set in the third chapter so it uses the default first page number, which continues from the previous chapter, and the default page orientation, which is portrait.

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

Add the title page.

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

Add the first chapter with the default numbering starting at 1 and the default page orientation set to portrait.

ch1 = Chapter();
ch1.Title = 'First Chapter';
sec = Section('First Section of Chapter 1');
txt = ['This is the first section of chapter 1. ',...
      'The first page number for this ',...
      'chapter is 1, which is the default. ',...
      'The page orientation is also the default.']; 
append(sec,txt);
append(ch1,sec);
append(rpt,ch1); 

Add the second chapter with the numbering reset to 1 and the page orientaton set to landscape.

ch2 = Chapter(); 
ch2.Title = '2nd chapter';
ch2.Layout.FirstPageNumber = 1;
ch2.Layout.Landscape = true;
sec = Section('First Section of Chapter 2'); 
txt = ['This is the first section of chapter 2. ',...
      'The first page number is set to 1 and the ',...
      'page orientation is set to landscape.'];
append(sec,txt);
append(ch2,sec);
append(rpt,ch2);

Add the third chapter without setting either the starting page number or the page orientation. This causes the chapter to revert to the defaults of page numbering continuing from the previous page and portrait page orientation.

ch3 = Chapter(); 
ch3.Title = '3rd chapter';
sec = Section('First Section of Chapter 3'); 
txt = ['This is the first section of chapter 3. ',...
      'Neither first page number nor page ',...
      'orientation is set for this chapter. ',...
      'The first page number uses the default, ',...
      'which continues from the previous page. ',...
      'The page orientation also uses the default, ',...
      'which is portrait.'];
append(sec,txt);
append(ch3,sec);
append(rpt,ch3);

Close and view the report.

close(rpt);
rptview(rpt)

Version History

Introduced in R2017b

expand all