Package: mlreportgen.report
Superclasses:
Title page reporter
Create a title page reporter that adds a title page to a report. This class inherits
from mlreportgen.report.Reporter
.
tp = TitlePage()
creates a title page reporter object that uses the
default title page template. The title page template does not include a page number in
the footer.
sets properties using name-value pairs. You can specify multiple name-value pair
arguments in any order. Enclose each property name in single quotes.tp
= TitlePage(Name,Value
)
createTemplate | Create title page template |
customizeReporter | Create custom title page reporter class |
getAuthorReporter | Get title page author reporter |
getClassFolder | Title page class definition file location |
getImageReporter | Get title page image reporter |
getPubDateReporter | Get title page publication date reporter |
getPublisherReporter | Get title page publisher reporter |
getSubtitleReporter | Get title page subtitle reporter |
getTitleReporter | Get title page title reporter |
copy | Create copy of reporter object and make deep copies of property values that reference a reporter, ReporterLayout, or DOM object |
customizeReporter | Create class derived from Reporter class |
getImpl | Get implementation of reporter |
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);
Create a title page that uses the default title format, but changes the title
color to red. In this case, you 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);
Create a title page that overrides the title property formatting. Change the title
font to 24 pt 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);
The template for a TitlePage
object determines its page
orientation, page margins, page size, and other page layout properties. You can
customize and override the title page layout using a customized version of its
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.
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.
This approach takes advantage of the fact that the TitlePage
object uses specialized reporters, called hole reporters, to apply element
templates to the elements. The TitlePage
reporter provides
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;