mlreportgen.dom.LOT class

Package:mlreportgen.dom
Superclasses:mlreportgen.dom.LOC

List of tables

Description

Use an object of themlreportgen.dom.LOTclass to create a list of tables in a report.

Each list item contains the title of a table and links to the title in the report. In a PDF orMicrosoft®Wordreport, a list item also includes the page number and a leader that fills the space between the title and page number. In a PDF or Word report, the list is located at the point in the report where you append theLOTobject. In an HTML report, the list is located in a sidebar with the titleList of Tables.

The way a list is generated depends on the report type.

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

  • Word — The DOM 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. SeeUpdate a Table of Contents or Generated List in a Word Document.

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

To include tables in the list of tables:

  1. Create titles for the tables usingmlreportgen.dom.Paragraph对象。

  2. Associate theParagraphobjects with a numbering stream that has the nametableby using anmlreportgen.dom.AutoNumberobject.

Themlreportgen.dom.LOTclass is ahandleclass.

Class Attributes

ConstructOnLoad
true
HandleCompatible
true

For information on class attributes, seeClass Attributes.

Creation

Description

example

LOTObj= mlreportgen.dom.LOT()creates anmlreportgen.dom.LOTobject and sets theLeaderPatternproperty to'.'.

LOTObj= mlreportgen.dom.LOT(leaderPattern)creates anmlreportgen.dom.LOTobject and sets theLeaderPatternproperty to the specified leader pattern.

Properties

expand all

Name of numbering stream, specified as'table'. Do not change the value of this property. To create a list of titles or captions using a custom numbering stream name, use anmlreportgen.dom.LOCobject.

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.

Name of the stylesheet-defined style for formatting the list of tables, specified as a character vector or string scalar.

The style specified by theStyleNameproperty must be defined in the stylesheet of the document or document part to which this list of tables titles is appended. The specified style defines the appearance of the list of tables in the output document, except for formats that are specified by theStyleproperty of thisLOTobject. The format objects specified by theStyleproperty override formats defined by the stylesheet.

Formats that define the style of the list of tables, specified as a cell array of DOM format objects. The formats override the corresponding formats defined by the stylesheet style specified by theStyleNameproperty. Formats that do not apply to a list of tables are ignored.

Custom attributes of this document element, specified as an array ofmlreportgen.dom.CustomAttribute对象。自定义属性必须支持b金宝appy the output format.

Parent of this document element, specified as a DOM object. This property is read-only.

Children of this document element, specified as an array of DOM objects. This property is read-only.

Tag for this document element, specified as a character vector or string scalar.

The DOM generates a session-unique tag as part of the creation of this object. The generated tag has the form CLASS:ID, where CLASS is the object class and ID is the value of theIdproperty of the object. Specifying your own tag value can help you to identify where an issue occurred during document generation.

ID for this document element, specified as a character vector or string scalar. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

Methods

expand all

Examples

collapse all

Create a list of tables as anmlreportgen.dom.LOTobject. To include tables in the list:

  • Create titles for the tables asmlreportgen.dom.Paragraph对象。

  • Associate theParagraphobjects with a numbering stream that has the nametable.

Import the DOM package so that you do not have to use long, fully qualified class names.

importmlreportgen.dom.*

Create a report.

d = Document("DOM Report with List of Tables","docx");

Create a list of tables container and append it to the report.

lotObj = LOT(); append(d,lotObj); append(d,PageBreak);

Create a table.

t1 = Table(magic(2));

Create a paragraph for the table title.

p1 =段("Table ");

Create an automatic numbering stream with the nametableand associate it with the paragraph.

append(p1,AutoNumber("table"));

Increment the counter for the numbering stream.

p1.Style = {CounterInc("table"),WhiteSpace("preserve")};

Append the rest of the title text to the paragraph and append the paragraph to the report.

append(p1,"."); append(p1," Order 2 Magic Square"); append(d,p1);

Append the table to the report after the table title.

append(d,t1);

Create another table and a title for the table. Associate thetablenumbering stream with the table title and increment the numbering counter.

t2 = Table(magic(3)); p2 = Paragraph("Table "); append(p2,AutoNumber("table")); p2.Style = {CounterInc("table"),WhiteSpace("preserve")};

Append the rest of the title text to the paragraph and append the paragraph to the report.

append(p2,"."); append(p2," Order 3 Magic Square"); append(d,p2);

Append the table to the report after the table title.

append(d,t2);

Close and view the report.

close(d); rptview(d);

Here is the list of tables in the generated report:

Introduced in R2020b