Main Content

mlreportgen.report.ListOfTables Class

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

List of tables reporter

Since R2020b

Description

Use an object of the mlreportgen.report.ListOfTables class to create a reporter that adds a list of tables section to a report. The generated list of tables contains the titles of the tables that are represented as mlreportgen.report.BaseTable objects in your report generation program. The list items link to the titles in the report. In PDF and Word reports, the list also includes the page numbers of the titles in the report. A leader fills the space between a title and the page number.

The way the list of tables 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.ListOfTables class is a handle class.

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

lot = mlreportgen.report.ListOfTables creates a ListOfTables reporter with default property values.

example

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

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

Properties

expand all

List of tables 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 Tables in the generated list of tables.

Type of leader to use between the title 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 tables 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 in one of these ways:

  • 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

  • Document Object Model (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 you append this reporter. 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 the 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 specified by the TemplateSrc property of this reporter.

Data Types: char | string

Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar value converts 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.ListOfTables reporter to add a section for a list of tables. The tables in the report are represented as mlreportgen.report.BaseTable objects so that the ListOfTables reporter includes them in the list of tables.

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("myTableReport","pdf");
open(rpt);

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

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

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

lot = ListOfTables();
lot.Title = "My List of Tables";
append(rpt,lot);

Create a chapter and add captioned tables to the chapter.

ch = Chapter("Magic Squares");
t1 = BaseTable(magic(2));
t1.Title = "Order Two Magic Square";
append(ch,t1);
t2 = BaseTable(magic(3));
t2.Title = "Order Three Magic Square";
append(ch,t2);

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

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

Here is the list of tables in the report:

Version History

Introduced in R2020b