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.
Properties
Since R2026a
Whether to use the layout from the parent report template, specified as a logical 1
(true) or 0 (false). When you
specify:
1(true) — Create a copy of the layout template in the parentmlreportgen.report.Reportobject, and apply the options from themlreportgen.report.ReportLayoutobject to the copy. Any nonempty properties of theReporterLayoutobject override the layout values of the parentReportobject.0(false) — Use the layout defined by the template of this reporter.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: logical
Watermark image, specified as [] or as a character
vector or string scalar that contains the image path name. You must set this
property before you open the report. 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
Note
Only PDF reports can have watermarks. Other report types ignore the content of this property.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: char | string
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.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: int32
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.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: char | string
Page orientation for the report section, specified as a logical 1
(true) or 0 (false). When you
specify:
[]— The orientation is determined by the page size specified by the section layout.1(true) — Set the page orientation to landscape.0(false) — Set the page orientation to portrait.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: logical
Size of pages in layout, specified as an mlreportgen.dom.PageSize object.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Sizes of page margins, header, footer, and gutter for this layout specified as an mlreportgen.dom.PageMargins object.
Attributes:
GetAccess | public |
SetAccess | public |
Page borders for layout, specified as an mlreportgen.dom.PageBorder object.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Examples
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 R2017bUse the UseReportLayout property to use the layout of the
parent report object. When you set UseReportLayout to true, the
class creates a copy of the layout from the parent report and applies any nonempty
options from the mlreportgen.report.ReportLayout object to the copy.
Report Generator no longer supports BMP (bitmap) as an output image format. This affects
snapshots, images from files, and watermarks in both the Report Explorer and the Report,
DOM, and PPT APIs. See print for more information.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)