Package:mlreportgen.report
Superclasses:mlreportgen.report.Reporter
Title page reporter
Use an object of themlreportgen.report.TitlePage
class to add a title page to a report.
Themlreportgen.report.TitlePage
class is ahandle
class.
HandleCompatible |
true
|
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. Enclose each property name in single or double quotes.tp
= mlreportgen.report.TitlePage(Name,Value
)
Title
—Title page titleTitle page title, specified as one of these values:
String scalar or character vector
DOM object
1-by-NorN-by-1 array of strings or DOM objects
1-by-NorN-by-1 cell array of strings, character vectors, or DOM objects
A Reporter created by thegetTitleReporter
method of this title page
Example:tp.Title = "My Report";
GetAccess |
public
|
SetAccess |
public
|
Subtitle
—Report subtitleReport subtitle, specified as one of these values:
String scalar or character vector
DOM object
1-by-NorN-by-1 array of strings or DOM objects
1-by-NorN-by-1 cell array of strings, character vectors, or DOM objects
Reporter created by thegetSubtitleReporter
method of this title page
Example:tp.Subtitle = "Part I";
GetAccess |
public
|
SetAccess |
public
|
Image
—Title page imageImage 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
reporter
DOM object
1-by-NorN-by-1 cell array of image paths, snapshot makers, or DOM objects
Reporter created by thegetImageReporter
method of this title page
Images formats with these file extensions are supported:
.bmp
– Bitmap
.gif
– Graphics Interchange Format
.jpg
– JPEG
.png
– Portable Network Graphics
.emf
– Enhanced metafile (supported only in.docx
output on Windows)
.svg
– Scalable Vector Graphic
.tif
– Tag Image File
Example:tp.Image = "reports/imagedir/titleimage.jpg";
GetAccess |
public
|
SetAccess |
public
|
Author
—Report authorReport author, specified as one of these values:
String scalar or character vector
DOM object
1-by-NorN-by-1 array of strings or DOM objects
1-by-NorN-by-1 cell array of strings, character vectors, or DOM objects
Reporter created by thegetAuthorReporter
method of this title page
If the environment variable user name is not found, the default value is empty.
Example:TitlePage("Author","John Smith")
GetAccess |
public
|
SetAccess |
public
|
Publisher
—Report publisherReport publisher, specified as one of these values:
String scalar or character vector
DOM object
1-by-NorN-by-1 array of strings or DOM objects
1-by-NorN-by-1 cell array of strings, character vectors, or DOM objects
Reporter created by thegetPublisherReporter
method of this title page
Example:tp.Publisher = "Smith Company";
GetAccess |
public
|
SetAccess |
public
|
PubDate
—Report publication dateReport publication date, specified as one of these values:
String scalar or character vector
DOM object
1-by-NorN-by-1 array of strings or DOM objects
1-by-NorN-by-1 cell array of strings, character vectors, DOM objects
Reporter created by thegetPubDateReporter
method of this title page
Example:tp.PubDate = "April 23, 2017";
GetAccess |
public
|
SetAccess |
public
|
Layout
—Page layout for title pagemlreportgen.report.ReporterLayout
objectPage layout for the title page, specified as anmlreportgen.report.ReporterLayout
object. Use the properties of theReporterLayout
object to override the default page layout properties, such as page orientation.
GetAccess |
public
|
SetAccess |
Restricts access
|
TemplateSrc
—Source of template for this reporter[]
(default) |character vector|string scalar|reporter or report|DOM document or document partSource 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 report to which this reporter is appended. For example, for aMicrosoft®Wordreport,TemplateSrc
must be a Word reporter template. If theTemplateSrc
property is empty, this reporter uses the default reporter template for the output type of the report.
GetAccess |
public
|
SetAccess |
public
|
TemplateName
—Name of template for this reporterName 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 theTemplateSrc
property of this reporter.
GetAccess |
public
|
SetAccess |
public
|
LinkTarget
—Hyperlink target for this reporter[]
(default) |character vector|string scalar|mlreportgen.dom.LinkTarget
objectHyperlink target for this reporter, specified as a character vector or string scalar that specifies the link target ID, or anmlreportgen.dom.LinkTarget
object. A character vector or string scalar value is converted to aLinkTarget
object. The link target immediately precedes the content of this reporter in the output report.
GetAccess |
public
|
SetAccess |
public
|
Method | Purpose |
---|---|
mlreportgen.report.TitlePage.createTemplate |
Create title page template |
mlreportgen.report.TitlePage.customizeReporter |
Create custom title page reported 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 object |
Create a title page that uses the default formatting. Add the title page to the report and view the report.
importmlreportgen.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);
Create a title page that uses the default title format, but changes the title color to red. Specify theTitle
property as a DOMText
object and set its color to red.
importmlreportgen.report.*importmlreportgen.dom.*rpt = Report("output","pdf"); tp = TitlePage; tp.Title = Text("Aircraft Tests"); tp.Title.Color ="red"; add(rpt,tp); close(rpt); rptview(rpt);
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 themlreportgen.dom.Paragraph
class defaults.
importmlreportgen.report.*importmlreportgen.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);
The template for aTitlePage
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. TheTitlePage
reporter supports two approaches to overriding title page element templates.
To use a customTitlePage
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 formTitlePageNAME
whereNAME
templat的名称吗e in the template library. For example, the name of the title template isTitlePageTitle
.
Set theTitlePage
TemplateSrc
property of the object to the path of the custom template.
This approach takes advantage of the fact that theTitlePage
object uses specialized reporters, called hole reporters, to apply element templates to the elements. Consequently, you can use theTitlePage
方法来获取g the reporter to apply a template to a particular element. For example, thegetTitleReporter
method returns the reporter used for applying theTitlePageTitle
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 thegetTitleReporter
method.
Set theTemplateSrc
property of the element reporter to the source of the template library containing the customized version of the element template.
SetContent
property of the element reporter to the element content.
Set the title page object element property to the element reporter object.
importmlreportgen.report.*importmlreportgen.dom.*rpt = Report("MyReport","pdf","MyCustomPDFTemplate"); tp = TitlePage; titleReporter = getTitleReporter(tp); titleReporter.TemplateSrc = rpt; titleReporter.Content ="My Report"; tp.Title = titleReporter;
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
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:.
Selectweb siteYou can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.