mlreportgen.report.ReporterLayout class

Package: mlreportgen.report
Superclasses:

Layout for reporter

Description

Page layout options (watermark, first page number, and page number format) for the report.

Note

Reports create instances of this object that are assigned to the Reporter Layout properties. You do not need to create this object yourself.

Properties

expand all

Watermark image for this reporter, specified as a string, character array, or []. A string or character array indicates the image path name. The specified watermark appears on all pages of the reporter. An empty, [], indicates that no watermark is included. Valid image types:

  • .bmp

  • .jpg

  • .pdf (for PDF output types only)

  • .png

  • .svg

  • .tiff

Number to use on the first page of this reporter in a Word or PDF report, specified as an integer or []. To continue page numbering from the previous layout, enter -1 or []. To specify the first page number, enter a positive integer.

Note

The default for Chapter page numbering is that the first page of the first chapter is 1.

Type of page numbering to use for this reporter in a Word or PDF report, specified as a string or character array. See the format property in mlreportgen.dom.PageNumber for a list of valid page number formats.

Page orientation for this reporter, specified as a logical value. The default orientation is portrait. Set this property to true to use landscape orientation.

Examples

Set First Page Number for a Chapter

Add three chapters reporters to a report. The first chapter uses default values for first page number and page orientation. The second chapter resets the first page number to 1 and uses landscape page orientation. Neither first page number nor page orientation is set in the third chapter. It uses the default first page number, which continues from the previous chapter, and default page orientation.

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.']; 
add(sec,txt)
add(ch1,sec)
add(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.'];
add(sec,txt)
add(ch2,sec)
add(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.'];
add(sec,txt)
add(ch3,sec)
add(rpt,ch3)

rptview(rpt)
Introduced in R2017b