Main Content

getImpl

Class: mlreportgen.report.Reporter
Namespace: mlreportgen.report

Get implementation of reporter

Syntax

impl = getImpl(reporter,report)

Description

impl = getImpl(reporter,report) returns the Document Object Model (DOM) object that implements the reporter, reporter, when you append it to the report, report.

Note

You cannot add content to the reporter after calling this method.

Input Arguments

expand all

Reporter object, specified as a mlreportgen.report.Reporter object or an object of a mlreportgen.report.Reporter subclass. For example, the mlreportgen.report.TitlePage and mlreportgen.report.Chapter classes are mlreportgen.report.Reporter subclasses.

Report, specified as a mlreportgen.report.Report object.

Output Arguments

expand all

Implementation of the reporter, returned as a DOM object. The DOM object is usually a mlreportgen.dom.DocumentPart type object. If it is a mlreportgen.dom.DocumentPart object, the object uses the template specified by the TemplateSrc and TemplateName properties of reporter.

Examples

expand all

Get the DOM object that implements a mlreportgen.report.TitlePage reporter.

rpt = mlreportgen.report.Report("My Report");
titlePage = mlreportgen.report.TitlePage;
titlePage.Title = "Data Summary";
impl = getImpl(titlePage,rpt);
impl = 

  DocumentPart with properties:

         TemplateName: 'TitlePage'
         TemplatePath: 'C:\Program Files\MATLAB\toolbox\shared\mlreportgen\rpt\rpt\+mlreportgen\+report\@TitlePage\resources\templates\pdf\default.pdftx'
                 Type: 'PDF'
        CurrentHoleId: '#end#'
      CurrentHoleType: 'Block'
    CurrentPageLayout: [1×1 mlreportgen.dom.PDFPageLayout]
           OpenStatus: 'open'
               Parent: []
             Children: [1×4 mlreportgen.dom.Element]
                  Tag: 'dom.LockedDocumentPart:5'
                   Id: '5'

Tips

  • Use getImpl to get information about the implementation of a reporter and use it elsewhere, such as an inline equation. See Create an Inline Equation in a Report.

  • The append method that you can use on mlreportgen.report.Report objects uses getImpl to append the reporter content to the DOM document object that implements the report. You can therefore use getImpl to append reporter content to other types of DOM objects.

  • If getImpl returns a mlreportgen.dom.DocumentPart object, the method fills the holes defined in the mlreportgen.dom.DocumentPart object source template with content in the properties of the reporter that match the hole names. If the property does not exist, getImpl fills the hole without adding content to it. For example, if a reporter myReporter specifies a template with a hole MyTemplateHole, getImpl fills the hole with content in the MyTemplateHole property of the reporter, if the property exists. If you do not want getImpl to fill the holes, create a custom reporter and override this method to return an object that you can add to the DOM document, such as a string or paragraph. See Define New Custom Reporters and Modify Inherited Methods.

  • To retrieve the implementation object while also maintaining the ability to add content to the reporter, create a clone of the reporter and use getImpl on the clone. To see an example that uses this method, see Create a Report with Pages in Portrait and Landscape Orientation.

Version History

Introduced in R2017b