Main Content

getTitleReporter

Class: mlreportgen.report.ListOfFigures
Namespace: mlreportgen.report

Get list of figures title reporter

Since R2020b

Syntax

titleReporter = getTitleReporter(lof)

Description

titleReporter = getTitleReporter(lof) returns the mlreportgen.report.Title reporter that the specified mlreportgen.report.ListOfFigures reporter uses to format the list of figures section title. Use the returned Title reporter to customize the alignment, position, and appearance of the title.

Input Arguments

expand all

List of figures reporter, specified as an mlreportgen.report.ListOfFigures object.

Output Arguments

expand all

List of figures reporter, returned as an mlreportgen.report.Title object.

Examples

expand all

Suppose that you defined a custom template for a list of figures title in the template library of a template for your report output type. To use the custom template:

  1. Get the title reporter using getTitleReporter.

  2. Set the properties of the title reporter. Set the Content property to the title text, the TemplateSrc property to the path and file name of the template file, and the TemplateName property to the name of the custom template for the list of figures title.

  3. Set the Title property of the list of figures reporter to the title reporter.

For example, suppose that the template file myTemplate.pdftx defines two templates to use with a list of figures title. One template, ListOfFiguresTitleRed, uses a style that makes the title red. The second template, ListOfFiguresTitleBlue, makes the title blue. This code applies the template that makes the title blue:

import mlreportgen.report.*
rpt = Report('myReport','pdf');
open(rpt);

lof = ListOfFigures();
titleReporter = getTitleReporter(lof);
titleReporter.Content = "My List of Figures";
titleReporter.TemplateSrc = "myTemplate.pdftx";
titleReporter.TemplateName = "ListOfFiguresTitleBlue";
lof.Title = titleReporter;
append(rpt,lof);

ch = Chapter("Vegetables");
f = FormalImage(which("peppers.png"));
f.Caption = "Peppers";
append(ch,f);
append(rpt,ch);
close(rpt);
rptview(rpt);

Version History

Introduced in R2020b