Main Content

mlreportgen.report.titlepage类

包裹:mlreportgen.Report
超类:mlreportgen.Report。Reporter

Title page reporter

Description

使用一个对象mlreportgen.report.titlepageclass to add a title page to a report.

mlreportgen.report.titlepageclass is a处理class.

类属性

兼容
真的

Creation

Description

例子

tp = mlreportgen.report.TitlePage()creates a title page reporter that uses the default title page template.

tp= mlreportgen.report.TitlePage(名称,价值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.

Properties

expand all

标题页标题,,,,specified as one of these values:

  • 字符串标量或字符向量

  • DOM对象

  • 1-by-norn-1串字符串或DOM对象数组

  • 1-by-norn-by-1 cell array of strings, character vectors, or DOM objects

  • A Reporter created by thegetTitleReporter此标题页的方法

Example:tp.Title = "My Report";

属性:

GetAccess
public
放Access
public

报告字幕,,,,specified as one of these values:

  • 字符串标量或字符向量

  • DOM对象

  • 1-by-norn-1串字符串或DOM对象数组

  • 1-by-norn-by-1 cell array of strings, character vectors, or DOM objects

  • getSubtitleReporter此标题页的方法

Example:tp.subtitle =“第i部分”;

属性:

GetAccess
public
放Access
public

在标题页中插入的图像,指定为以下值之一:

  • 字符串标量或字符向量that specifies the file system path of the image

  • mlreportgen.report.figurereporter

  • DOM对象

  • 1-by-norn-by-1 cell array of image paths, snapshot makers, or DOM objects

  • getImageReporter此标题页的方法

图片s formats with these file extensions are supported:

  • 。bmp– Bitmap

  • .gif- 图形互换格式

  • .jpg- JPEG

  • 。png- 便携式网络图形

  • .emf– Enhanced metafile (supported only in。docx在Windows上输出)

  • 。svg- 可伸缩矢量图形

  • .tif– Tag Image File

Example:tp.Image = "reports/imagedir/titleimage.jpg";

属性:

GetAccess
public
放Access
public

报告作者,,,,specified as one of these values:

  • 字符串标量或字符向量

  • DOM对象

  • 1-by-norn-1串字符串或DOM对象数组

  • 1-by-norn-by-1 cell array of strings, character vectors, or DOM objects

  • getAuthorReporter此标题页的方法

If the environment variable user name is not found, the default value is empty.

Example:标题页("Author","John Smith")

属性:

GetAccess
public
放Access
public

报告发布者,指定为以下值之一:

  • 字符串标量或字符向量

  • DOM对象

  • 1-by-norn-1串字符串或DOM对象数组

  • 1-by-norn-by-1 cell array of strings, character vectors, or DOM objects

  • getPublisherReporter此标题页的方法

Example:tp.publisher =“史密斯公司”;

属性:

GetAccess
public
放Access
public

Report publication date, specified as one of these values:

  • 字符串标量或字符向量

  • DOM对象

  • 1-by-norn-1串字符串或DOM对象数组

  • 1-by-norn-by-1 cell array of strings, character vectors, DOM objects

  • GetPubDatereporter此标题页的方法

Example:tp.pubdate =“ 2017年4月23日”;

属性:

GetAccess
public
放Access
public

Page layout for the title page, specified as anmlreportgen.Report。ReporterLayout目的。使用ReporterLayout目的to override the default page layout properties, such as page orientation.

属性:

GetAccess
public
放Access
Restricts access

该记者的模板来源,以以下方式指定:

  • Character vector or string scalar that specifies the path of the file that contains the template for this reporter

  • 记者或报告将其模板用于此记者或其模板库包含此记者的模板

  • DOM文档或文档部分的模板用于此报告者或其模板库包含此报告者的模板

指定的模板必须相同类型作为the report to which this reporter is appended. For example, for a微软®Word报告,TemplateSrcmust be a Word reporter template. If theTemplateSrcproperty is empty, this reporter uses the default reporter template for the output type of the report.

属性:

GetAccess
public
放Access
public

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 theTemplateSrc此记者的财产。

属性:

GetAccess
public
放Access
public

Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the link target ID, or anmlreportgen.dom.LinkTarget目的。字符向量或字符串标量值转换为LinkTarget目的。这link target immediately precedes the content of this reporter in the output report.

属性:

GetAccess
public
放Access
public

方法s

expand all

Examples

全部收缩

创建使用默认格式的标题页。将标题页添加到报告中并查看报告。

importmlreportgen.Report。*rpt = Report(“输出”,,,,"pdf");tp = TitlePage(); tp.Title =“飞机测试”;tp.subtitle ="Monthly Data";tp.Image = which("b747.jpg");tp.author =“约翰·史密斯”;tp.Publisher ="MathWorks";tp.pubdate = date();添加(RPT,TP);关闭(RPT);RPTView(RPT);

Create a title page that uses the default title format, but changes the title color to red. Specify theTitle属性作为DOM文本对象并将其颜色设置为红色。

importmlreportgen.Report。*importmlreportgen.dom.*rpt = Report(“输出”,,,,"pdf");tp = titlepage;tp.Title = Text(“飞机测试”);tp.Title.Color ="red";添加(RPT,TP);关闭(RPT);RPTView(RPT);

创建一个覆盖标题属性格式化的标题页。将标题字体更改为24点Arial,标题文本颜色为白色,并使用蓝色背景。您未指定的任何样式使用mlreportgen.dom.Paragraphclass defaults.

importmlreportgen.Report。*importmlreportgen.dom.*rpt = Report(“输出”,,,,"pdf");tp = TitlePage(); title = Paragraph(“飞机测试”);title.Style = {halign("left"),FontFamily(“ Arial”),。。。FontSize("24pt"),Color(“白色的”),。。。背景颜色("blue"),。。。OuterMargin(“ 0in”,,,,“ 0in”,,,,“ .5in”,,,,“ 1英寸”),。。。HAlign("center")}; tp.Title = title; tp.Subtitle ="Monthly Data";tp.Image = which("b747.jpg");tp.author =“约翰·史密斯”;tp.Publisher ="MathWorks";tp.pubdate = date();添加(RPT,TP);关闭(RPT);RPTView(RPT);

这template for a标题页对象确定页面方向,页面边距,页面大小和其他页面布局属性。您可以使用默认模板的自定义版本自定义和覆盖标题页布局。您还可以通过自定义这些元素模板来自定义单个标题元素。这标题页reporter supports two approaches to overriding title page element templates.

To use a custom标题页模板:

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 formtitle -pagenamewherenAME是模板库中模板的名称。例如,标题模板的名称是titlepagetitle

放the标题页TemplateSrcproperty of the object to the path of the custom template.

This approach takes advantage of the fact that the标题页对象使用专门的记者(称为孔记者)将元素模板应用于元素。因此,您可以使用标题页methods for getting the reporter to apply a template to a particular element. For example, thegetTitleReporter方法返回的porter used for applying thetitlepagetitle模板与报告标题的内容。

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 thegetTitleReportermethod.

放theTemplateSrc元素记者的属性到包含元素模板的自定义版本的模板库的源。

Content元素记者属性属于元素内容。

将标题页对象元素属性设置为“元素报告”对象。

importmlreportgen.Report。*importmlreportgen.dom.*rpt = Report(“我的报告”,,,,"pdf",,,,"MyCustomPDFTemplate");tp = titlepage;titlereporter = getTitLereporter(tp);titlereporter.templatesrc = rpt;titlereporter.content ="My Report";tp.title = titlereporter;
在R2017b中引入