A DOM API formal table has header, body, and footer sections. A formal table is useful when a header or footer has multiple rows. The separate header, body, and footer sections facilitate adding rows to and formatting the header, body, or footer independently of the other sections. For information about other types of tables that you can create in reports, seeChoose Type of Table to Create. For information about formatting tables, seeFormat Tables.
A formal table is represented by anmlreportgen.dom.FormalTable
对象。The header, body, and footer sections are represented bymlreportgen.dom.TableHeader
,mlreportgen.dom.TableBody
, 和mlreportgen.dom.TableFooter
objects, respectively. Each section has rows and table entries. The rows are represented bymlreportgen.dom.TableRow
对象。Entries in the body and footer sections are represented bymlreportgen.dom.TableEntry
对象。Entries in the header are represented bymlreportgen.dom.TableHeaderEntry
要么mlreportgen.dom.TableEntry
对象。
You can create the sections of a formal table from a MATLAB®array. This approach is the simplest because you do not have to createTableRow
和TableEntry
要么TableHeaderEntry
对象。您还可以通过构建表来创建这些部分TableRow
和TableEntry
要么TableHeaderEntry
对象。This approach is useful for complex formatting requirements, such as an when an entry spans multiple columns or rows. You can combine the approaches. For example, you can create the table body from an array and build the header from rows and entries.
Create a formal table by using themlreportgen.dom.FormalTable
constructor. The constructor optionally accepts a two-dimensional array or a cell array of MATLAB data for the body, header, and footer sections. See the标题
,body
, 和页脚
arguments on themlreportgen.dom.FormalTable
参考页面。有关从字符串数组中创建正式表标题的示例,以及从单元格数组中的正式表身体,请参阅Create a Table from a Cell Array.
You can build the header, body, or footer sections of a formal table by appending table entries to table rows and appending the rows to the sections.
To create a header entry, you can use anmlreportgen.dom.TableHeaderEntry
要么mlreportgen.dom.TableEntry
对象。如果you create a header from an array, the DOM API creates the entries asTableHeaderEntry
对象。In an HTML report, the DOM API renders aTableHeaderEntry
object as ath
(table header cell) element. This rendering relies on the browser to format the table entry. For Word and PDF reports, by default, the DOM API renders theTableHeaderEntry
object as an unformatted Word or PDF table entry element. You can use theTableHeaderEntry
object properties to format the table entries generated for all output types. For example, you can use these properties to override browser formatting in HTML reports.
要从表行和条目构建正式表的一部分,可以使用FormalTable
appendHeaderRow
,append
, 和appendFooterRow
methods to append rows to the table header, body, or footer sections. Alternatively, you can access a section by using theHeader
,身体
, orFooter
properties of theFormalTable
object and then append rows to the section by using theappend
方法。
For an example that builds a header from entries and rows, seeFormal TableinSpan a Table Entry Across Rows and Columns.
appendFooterRow
|appendHeaderRow
|mlreportgen.dom.FormalTable
|mlreportgen.dom.TableBody
|mlreportgen.dom.TableEntry
|mlreportgen.dom.TableFooter
|mlreportgen.dom.TableHeader
|mlreportgen.dom.TableHeaderEntry