mlreportgen.report.ReportLayout class

Package: mlreportgen.report
Superclasses:

Page layout of report

Description

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

Note

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

Properties

expand all

Watermark image for this report, 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 report. An empty, [], indicates that no watermark is included. To use a different watermark for an individual reporter, such as a chapter, set the watermark for that reporter using its Layout.Watermark property. Valid image types:

  • .bmp

  • .jpg

  • .pdf (for PDF output types only)

  • .png

  • .svg

  • .tiff

Number to use on the first page of each reporter in a Word or PDF 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 reporter, set its Layout.FirstPageNumber property. 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 each reporter a Word or PDF report, specified as a string or character array. The specified page number format appears on all pages of the report. To use a different page number format for an individual reporter, such as a chapter, set its Layout.PageNumberFormat. See the format property in mlreportgen.dom.PageNumber for a list of valid page number formats.

Page orientation of the report, specified as a logical value. The default orientation for all pages of the report is portrait. Set this property to true to use landscape orientation. To use a different page orientation for an individual reporter, such as a chapter, set the Layout.Landscape property for that reporter.

Examples

Set First Page Number for Entire Report

Set the page number format for the whole report to Arabic numbers. Set the table of contents to use Roman numerals. This chapters use the default Arabic number format. 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'; 
add(rpt,tp);

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

ch = Chapter();
ch.Title = 'Introduction';
%ch.Layout.PageNumberFormat = 'n';
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 first chapter.'];
add(sec,txt);
add(ch,sec);
add(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 whole report.'];
add(sec,txt);
add(ch,sec);
add(rpt,ch)

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

rptview(rpt);
Introduced in R2017b