List of tables reporter
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
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 a Table of Contents or Generated List in a Word Document.
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.
mlreportgen.report.ListOfTables class is a
For information on class attributes, see Class Attributes.
lot = mlreportgen.report.ListOfTables()
ListOfTables reporter with default property values.
lot = mlreportgen.report.ListOfTables(
ListOfTables reporter with the Title
property set to the specified title.
sets properties using name-value pairs. You can specify multiple name-value pair arguments
in any order. Enclose each property name in single or double quotes.
lot = mlreportgen.report.ListOfTables(
Title— List of tables section title
| string scalar | character vector | inline DOM object |
mlreportgen.report.Titleobject | ...
List of tables section title, specified as one of these values:
String scalar or character vector
Inline DOM object, such as an
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
If you do not specify the
Title property, the title is
List of Tables in the generated list of tables.
LeaderPattern— Type of leader
'.'(default) | 'dots' |
' '| 'space'
Type of leader to use between the title and the page number, specified as one of these character vectors or string scalars:
' ' or
This property applies only to PDF reports. Word reports always have a dots leader. HTML reports do not have a leader.
Layout— Page layout
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.
TemplateSrc— Source of template for this reporter
(default) | character vector | string scalar | reporter or report | DOM document or document part
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
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
TemplateSrc property is empty, this reporter uses the default
reporter template for the output type of the report.
TemplateName— Name of template for this reporter
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
TemplateSrc) for this reporter.
LinkTarget— Hyperlink target for this reporter
(default) | character vector | string scalar |
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 is converted to a
LinkTarget object. The link target immediately
precedes the content of this reporter in the output report.
|Create list of tables reporter template|
|Create custom list of tables reporter class|
|Get location of list of tables reporter class definition file|
|Create copy of reporter object and make deep copies of property values that reference a reporter, ReporterLayout, or DOM object|
|Get implementation of reporter|
|Get list of tables title reporter|
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 package so that you do not have to use long, fully qualified class names.
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: