Subclass Reporter Definitions
If a built-in reporter meets some of your requirements, consider subclassing the reporter. Subclassing a reporter allows you to rearrange and expand the content of a built-in reporter. To subclass a built-in reporter:
Create a custom reporter definition based on the class definition of the built-in reporter, using the
customizeReporter
method of the built-in reporter.For example, the following code creates a folder named
@MyTitlePage
in the current folder.mlreportgen.report.TitlePage.customizeReporter('@MyTitlePage');
The created folder contains a class definition file named
MyTitlePage.m
. The class definition file defines a subclass of the built-inTitlePage
reporter. The class definition folder also contains copies of theTitlePage
reporter templates, which are stored in a subfolder namedresources
.Edit the template copies to rearrange the holes for the content of the built-in reporter or add holes for additional generated content.
If you add holes to the templates of the new reporter, edit the reporter class definition file to define properties that specify the content that fills the holes. Define a property for each hole that you have added to the template of the new reporter. The name of the property must be the same as the name of the hole.