mlreportgen.report.TitlePage Class
Namespace: mlreportgen.report
Superclasses: mlreportgen.report.Reporter
Title page reporter
Description
Use an object of the mlreportgen.report.TitlePage
class to add a title
page to a report.
The mlreportgen.report.TitlePage
class is a handle
class.
Class Attributes
HandleCompatible | true |
Creation
Description
tp = mlreportgen.report.TitlePage
creates a
title page reporter that uses the default title page
template.
sets properties using name-value pairs. You can specify multiple name-value pair
arguments in any order.tp
= mlreportgen.report.TitlePage(Name=Value
)
Properties
Title
— Title page title
[]
(default) | character vector | string scalar | DOM element object | getTitleReporter
reporter | ...
Title page title, specified as one of these values:
String scalar or character vector
DOM element object
1-by-N or N-by-1 array of strings or DOM element objects
1-by-N or N-by-1 cell array of strings, character vectors, or DOM element objects
A Reporter created by the
getTitleReporter
method of this title page
Example: tp.Title = "My Report";
Subtitle
— Report subtitle
[]
(default) | character vector | string scalar | DOM element object | getSubtitleReporter
reporter | ...
Report subtitle, specified as one of these values:
String scalar or character vector
DOM element object
1-by-N or N-by-1 array of strings or DOM element objects
1-by-N or N-by-1 cell array of strings, character vectors, or DOM element objects
Reporter created by the
getSubtitleReporter
method of this title page
Example: tp.Subtitle = "Part I";
Image
— Title page image
[]
(default) | character vector | string scalar | DOM Image
object | getImageReporter
reporter | ...
Image to insert in title page, specified as one of these values:
String scalar or character vector that specifies the file system path of the image
mlreportgen.report.Figure
reporterDOM element object
1-by-N or N-by-1 cell array of image paths, snapshot makers, or DOM element objects
Reporter created by the
getImageReporter
method of this title page
The table lists supported image formats and file extensions.
Image Format | File Extension | Supported in HTML | Supported in Word | Supported in PDF |
---|---|---|---|---|
Windows® metafile | .emf | No | Yes | No |
Graphics Interchange Format | .gif | Yes | Yes | Yes |
JPEG image | .jpg | Yes | Yes | Yes |
.pdf | No | No | Yes | |
Portable Network Graphics | .png | Yes | Yes | Yes |
Scalable Vector Graphics | .svg | Yes | Yes | Yes |
TIFF image | .tif | No | Yes | Yes |
Example: tp.Image =
"reports/imagedir/titleimage.jpg";
Author
— Report author
environment variable user name (default) | character vector | string scalar | DOM element object | getAuthorReporter
reporter | ...
Report author, specified as one of these values:
String scalar or character vector
DOM element object
1-by-N or N-by-1 array of strings or DOM element objects
1-by-N or N-by-1 cell array of strings, character vectors, or DOM element objects
Reporter created by the
getAuthorReporter
method of this title page
If the environment variable user name is not found, the default value is empty.
Example: TitlePage("Author","John Smith")
Publisher
— Report publisher
[]
(default) | character vector | string scalar | DOM element object | getPublisherReporter
reporter | ...
Report publisher, specified as one of these values:
String scalar or character vector
DOM element object
1-by-N or N-by-1 array of strings or DOM element objects
1-by-N or N-by-1 cell array of strings, character vectors, or DOM element objects
Reporter created by the
getPublisherReporter
method of this title page
Example: tp.Publisher = "Smith Company";
PubDate
— Report publication date
character vector | string scalar | DOM element object | getPubDateReporter
reporter | ...
Report publication date, specified as one of these values:
String scalar or character vector
DOM element object
1-by-N or N-by-1 array of strings or DOM element objects
1-by-N or N-by-1 cell array of strings, character vectors, DOM element objects
Reporter created by the
getPubDateReporter
method of this title page
Example: tp.PubDate = "April 23, 2017";
Layout
— Page layout for title page
mlreportgen.report.ReporterLayout
object
Page layout for the title page, specified as an mlreportgen.report.ReporterLayout
object. Use the properties of
the ReporterLayout
object to override the default page layout
properties, such as page orientation.
TemplateSrc
— Source of template for reporter
[]
(default) | character vector | string scalar | reporter or report | DOM document or document part
Source of the template for this reporter, specified in one of these ways:
Character vector or string scalar that specifies the path of the file that contains the template for this reporter
Reporter or report whose template is used for this reporter or whose template library contains the template for this reporter
DOM document or document part whose template is used for this reporter or whose template library contains the template for this reporter
The specified template must be the same type as the report to which you
append this report. For example, for a Microsoft® Word report, TemplateSrc
must be a Word reporter template.
If the TemplateSrc
property is empty, this reporter uses the
default reporter template for the output type of the report.
TemplateName
— Name of template for this reporter
character vector | string scalar
Name of the template for this reporter, specified as a character vector or string scalar.
The template for this reporter must be in the template library of the template specified by
the TemplateSrc
property of this reporter.
Data Types: char
| string
LinkTarget
— Hyperlink target for this reporter
[]
(default) | character vector | string scalar | mlreportgen.dom.LinkTarget
object
Hyperlink target for this reporter, specified as a character vector or string scalar
that specifies the link target ID, or an mlreportgen.dom.LinkTarget
object. A character vector or string scalar
value converts to a LinkTarget
object. The link target immediately
precedes the content of this reporter in the output report.
Methods
Public Methods
Method | Purpose |
---|---|
mlreportgen.report.TitlePage.createTemplate | Create title page template |
mlreportgen.report.TitlePage.customizeReporter
| Create custom title page reporter class |
mlreportgen.report.TitlePage.getClassFolder | Get title page class definition file location |
getAuthorReporter | Get title page author reporter |
getImageReporter | Get title page image reporter |
getPublisherReporter | Get title page publisher reporter |
getSubtitleReporter | Get title page subtitle reporter |
getTitleReporter | Get title page title reporter |
getPubDateReporter | Get title page publication date reporter |
getImpl | Get implementation of reporter |
copy | Create copy of reporter object and make deep copies of property
values that reference a reporter, ReporterLayout ,
or DOM element object |
Examples
Default Title Page
Create a title page that uses the default formatting. Add the title page to the report and view the report.
import mlreportgen.report.* rpt = Report("output","pdf"); tp = TitlePage(); tp.Title = "Aircraft Tests"; tp.Subtitle = "Monthly Data"; tp.Image = which("b747.jpg"); tp.Author = "John Smith"; tp.Publisher = "MathWorks"; tp.PubDate = date(); add(rpt,tp); close(rpt); rptview(rpt);
Title Page with Customized Color
Create a title page that uses the default title format, but
changes the title color to red. Specify the Title
property
as a DOM Text
object and set its color to red.
import mlreportgen.report.* import mlreportgen.dom.* rpt = Report("output","pdf"); tp = TitlePage; tp.Title = Text("Aircraft Tests"); tp.Title.Color = "red"; add(rpt,tp); close(rpt); rptview(rpt);
Override Title Page Title Formatting
Create a title page that overrides the title property formatting. Change the title font to 24-point Arial, the title text color to white, and use a blue background. Any styles you do not specify use the mlreportgen.dom.Paragraph
class defaults.
import mlreportgen.report.* import mlreportgen.dom.* rpt = Report("output","pdf"); tp = TitlePage(); title = Paragraph("Aircraft Tests"); title.Style = {HAlign("left"),FontFamily("Arial"),... FontSize("24pt"),Color("white"),... BackgroundColor("blue"),... OuterMargin("0in","0in",".5in","1in"),... HAlign("center")}; tp.Title = title; tp.Subtitle = "Monthly Data"; tp.Image = which("b747.jpg"); tp.Author = "John Smith"; tp.Publisher = "MathWorks"; tp.PubDate = date(); add(rpt, tp); close(rpt); rptview(rpt);
Override Title Page Formatting and Layout Using Custom Template
The template for a TitlePage
object determines
the page orientation, page margins, page size, and other page layout properties.
You can customize and override the title page layout by using a customized
version of the default template. You can also customize individual title page
elements by customizing those element templates. The TitlePage
reporter supports two approaches to overriding title page element templates.
To use a custom TitlePage
template:
Create a copy of the default title page template.
Edit the title page element templates as desired in the copy of the
template. The names of the templates have the form
TitlePageNAME
where NAME
is the
name of the template in the template library. For example, the name of the
title template is TitlePageTitle
.
Set the TitlePage
TemplateSrc
property of the object to the path of the
custom template.
Override Title Page Formatting and Layout Using Different template Library
This approach takes advantage of the fact that the
TitlePage
object uses specialized reporters, called hole
reporters, to apply element templates to the elements. Consequently, you can use
the TitlePage
methods for getting the reporter to apply a
template to a particular element. For example, the
getTitleReporter
method returns the reporter used for
applying the TitlePageTitle
template to the content of the report
title.
Copy the title page element templates that you want to customize into a different template library. For example, you can copy the template library of the report or the template library of a DOM document part object. These template libraries are often libraries that you created to store customized versions of templates.
For each title page element to be customized, get its element reporter.
For example, for the title, use the getTitleReporter
method.
Set the TemplateSrc
property of the element reporter
to the source of the template library containing the customized version of
the element template.
Set Content
property of the element reporter to the
element content.
Set the title page object element property to the element reporter object.
import mlreportgen.report.* import mlreportgen.dom.* rpt = Report("MyReport","pdf","MyCustomPDFTemplate"); tp = TitlePage; titleReporter = getTitleReporter(tp); titleReporter.TemplateSrc = rpt; titleReporter.Content = "My Report"; tp.Title = titleReporter;
Version History
Introduced in R2017bR2024b: Removal of BMP for image output
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-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- 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)