Main Content

mlreportgen.report.ListOfFigures Class

Namespace: mlreportgen.report
Superclasses: mlreportgen.report.Reporter

List of figures reporter

Since R2020b

Description

Use an object of the mlreportgen.report.ListOfFigures class to create a reporter that adds a list of figures section to a report. The generated list of figures contains the captions of the figures (images) that are represented as mlreportgen.report.FormalImage or mlreportgen.report.Figure objects in your report generation program. The list entries link to the captions in the report. In PDF and Word reports, the list also includes the page numbers of the captions in the report. A leader fills the space between a caption and its page number.

The way the list of figures is generated depends on the report type:

  • PDF — The Report API generates the list during report generation.

  • Word — The Report API generates a placeholder for the list. To generate the list items, you must update the Word document in your report generation program or in Word. See Update Tables of Contents and Generated Lists in Word Documents.

  • HTML — The Report API generates a placeholder for the list. When the report opens in an HTML browser, the browser generates the list in a sidebar.

The mlreportgen.report.ListOfFigures class is a handle class.

Class Attributes

Abstract
true

For information on class attributes, see Class Attributes.

Creation

Description

example

lof = mlreportgen.report.ListOfFigures creates a ListOfFigures reporter with default property values.

lof = mlreportgen.report.ListOfFigures(title) creates a ListOfFigures reporter with the Title property set to the specified title.

lof = mlreportgen.report.ListOfFigures(Name=Value) sets properties using name-value pairs. You can specify multiple name-value pair arguments in any order.

Properties

expand all

List of figures section title, specified as one of these values:

  • String scalar or character vector

  • Inline DOM object, such as an mlreportgen.dom.Text object

  • 1-by-N or N-by-1 array of string scalars or inline DOM objects

  • 1-by-N or N-by-1 cell array that contains any combination of strings, character vectors, or inline DOM objects

  • mlreportgen.report.Title object returned by the getTitleReporter method

If you do not specify the Title property, the title is List of Figures.

Type of leader to use between the caption and the page number, specified as one of these character vectors or string scalars:

  • '.' or 'dots'

  • ' ' or 'space'

This property applies only to PDF reports. Word reports always have a dots leader. HTML reports do not have a leader.

Page layout for the list of figures section, specified as an mlreportgen.report.ReporterLayout object. Use the properties of the ReporterLayout object to override the some of the default page layout properties, such as page orientation.

Source of the template for this reporter, specified as one of these options:

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

  • Reporter or report whose template is used for this reporter or whose template library contains the template for this reporter

  • DOM document or document part whose template is used for this reporter or whose template library contains the template for this reporter

The specified template must be the same type as the report to which this reporter is appended. For example, for a Microsoft® Word report, TemplateSrc must be a Word reporter template. If the TemplateSrc property is empty, this reporter uses the default reporter template for the output type of the report.

Name of 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 source (TemplateSrc) for this reporter.

Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the link target ID or as an mlreportgen.dom.LinkTarget object. A character vector or string scalar value is converted to a LinkTarget object. The link target immediately precedes the content of this reporter in the output report.

Methods

expand all

Examples

collapse all

This example uses an mlreportgen.report.TableOfContents reporter to add a table of contents to a report and an mlreportgen.report.ListOfFigures reporter to add a section for a list of figures. The figures (images) in the report are represented as mlreportgen.report.Figure or mlreportgen.report.FormalImage objects so that the ListOfFigures reporter includes them in the list of figures.

Import the Report API namespace so that you do not have to use long, fully qualified class names.

import mlreportgen.report.*

Create a report.

rpt = Report("myFigureReport","pdf");
open(rpt);

Create a table of contents and add it to the report.

toc = TableOfContents();
append(rpt,toc);

Create a list of figures section and add it to the report.

lof = ListOfFigures();
lof.Title = "My List of Figures";
append(rpt,lof);

Create a chapter and add a captioned image and figure to the chapter.

ch = Chapter("Images");
image1 = FormalImage(which("peppers.png"));
image1.Caption = "Peppers";
image1.Height = "5in";
append(ch,image1);
surf(peaks);
fig = Figure();
fig.Snapshot.Caption = '3-D shaded surface plot';
fig.Snapshot.Height = '5in';
append(ch,fig);

Add the chapter to the report. Close and view the report.

append(rpt,ch);
delete(gcf);
close(rpt);
rptview(rpt);

Here is the list of figures in the report:

Version History

Introduced in R2020b