Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mlreportgen.report.BaseTable class

Package: mlreportgen.report
Superclasses:

Create table reporter

Description

Create a reporter for a table that includes a title.

Construction

table = BaseTable() creates an empty table reporter. Use its properties to specify the table content, automatically numbered table title, and table style and width.

table = BaseTable(content) creates a table reporter that formats the content as a table and adds it to a report.

table = BaseTable(Name,Value) sets properties using name-value pairs. You can specify multiple name-value pair arguments in any order. Enclose each property name in single quotes.

Input Arguments

expand all

See the mlreportgen.dom.Table, FormalTable or MATLABTable properties.

Properties

expand all

Table title, specified as one of these values:

  • String or character array

  • DOM object

  • 1-by-N or N-by-1 array of strings or DOM objects

  • 1-by-N or N-by-1 cell array of strings, character arrays, and/or DOM objects

  • Hole reporter returned by the getTitleReporter method

Inline content is content that a paragraph can contain. If the title value is inline content, the table reporter uses a template stored in its template library to format the title. The template automatically numbers the table title using a format that depends on whether the table is in a numbered or unnumbered chapter.

  • A table in a numbered chapter has a title text prefix of the form 'Table N.M. ' N is the chapter number and M is the table number in the chapter. For example, the prefix for the third table in the second chapter of the report is Table 2.3.

  • A table in unnumbered chapter has a title text prefix of the form 'Table N.' N is 1 for the first table in the report, 2 for the second table, and so on.

In many non-English locales, the title prefix is translated to the language and format of the locale. See the Locale property of mlreportgen.report.Report for a list of translated locales.

Table content, specified as one of these values:

  • DOM Table object

  • DOM Formal Table object

  • DOM MATLAB® Table object

  • Two-dimensional array or cell array of DOM or built-in MATLAB objects

  • Hole reporter returned by getTitleReporter method

Use the Section constructor or add method to set this property. You cannot set it directly.

Name of style to be applied to the table, specified as a string or character array. The specified style must be a table style defined in the template used by the report to which you append this table or in the template of a reporter added to the report..

An empty TableStyleName property value specifies a default table style defined for the template of the reporter. The default style for the table is a grid.

Width of this table, specified as a string or character array. The TableWidth format is valueUnits, where Units is an abbreviation for the width units and value is the number of units. The table shows the valid Units abbreviations.

Units AbbreviationUnits
pxpixels
cmcentimeters
ininches
mmmillimeters
pcpicas
ptpoints
%percent

Example: 5in

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

  • String or character array specifying the path of the file containing the template for this reporter

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

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

The specified template must be of the same type as the report to which this reporter is appended. For example, for a 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 string or character array. The template for this reporter is in the template library of the template source (TemplateSrc) for this reporter.

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

Example: firstchapter.LinkTarget = 'ch1_link';

Methods

createTemplate Create table template
getClassFolder Base table class definition file location
getContentReporter Get base table content hole reporter
getTitleReporter Get base table title reporter

Inherited Methods

getImpl Get implementation of reporter

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects (MATLAB).

Examples

Add Tables to a Report

Add two tables to a report. The first table is a rank 5 magic square. The second table includes two images.

import mlreportgen.report.*
import mlreportgen.dom.*

report = Report('tables');
chapter = Chapter();
chapter.Title = 'Table example';
add(report, chapter);

table = BaseTable(magic(5));
table.Title = 'Rank 5 Magic Square';
add(report,table);

add(report,Paragraph());
imgSize = {Height('2in'),Width('2in')};
img1 = Image(which('b747.jpg'));
img1.Style = imgSize;
img2 = Image(which('peppers.png'));
img2.Style = imgSize;
table = BaseTable({'Boeing 747' 'Peppers'; img1, img2});
table.Title = 'Picture Gallery';
add(report,table);

delete(gcf);
rptview(report);

Introduced in R2017b

Was this topic helpful?