Main Content

mlreportgen.report.ReporterLayout class

Package: 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 for the report section pages, specified as [] or 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:

  • .bmp

  • .jpg

  • .pdf (for PDF output types only)

  • .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 string scalar or character vector. See the Format property in mlreportgen.dom.PageNumber for a list of valid page number formats.

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.

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

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

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

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

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

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

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

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(rpt);
rptview(rpt)
Introduced in R2017b