mlreportgen.report.HTMLModuleTabs Class
Namespace: mlreportgen.report
Superclasses: mlreportgen.report.Reporter
Description
An mlreportgen.report.HTMLModuleTabs
reporter adds a widget consisting of a
stack of tabbed panels (module tabs) to an HTML report. Selecting a tab displays the contents
of the panel. Use this reporter to display related information in compact form.
Note
Use HTMLModuleTabs
reporters only with HTML or single-file HTML
reports.
The mlreportgen.report.HTMLModuleTabs
class is a handle
class.
Creation
Description
tabsObj = mlreportgen.report.HTMLModuleTabs
creates an empty HTMLModuleTabs
reporter. You must specify the tab labels
and content using the TabsData
property. Adding an empty HTMLModuleTabs
reporter to a report produces an
error.
tabsObj = mlreportgen.report.HTMLModuleTabs(Name=Value)
sets properties using name-value pairs. You can specify multiple name-value pair arguments
in any order.
Properties
TabsData
— Tab label and panel content
structure array
Tab label and panel content, specified as an array of structures with these fields:
Label
— Tab label, specified as a character vector, a string scalar, or anmlreportgen.dom.Text
object. Use a unique label for each tab.Content
— Panel content, specified as one of these values:A character vector or string scalar
A DOM object
A Report API reporter object
Note
To include multiple DOM objects on one tab, set the
Content
field to anmlreportgen.dom.Group
object that contains the DOM objects.
TemplateSrc
— Source of template for this reporter
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
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.
TemplateName
— Name of template for this reporter
character vector | string scalar
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
LinkTarget
— Hyperlink target for this reporter
[]
(default) | character vector | string scalar | mlreportgen.dom.LinkTarget
object
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
Public Methods
mlreportgen.report.HTMLModuleTabs.createTemplate | Create a copy of the HTML module tabs reporter template |
mlreportgen.report.HTMLModuleTabs.customizeReporter | Create a custom HTML module tabs reporter |
mlreportgen.report.HTMLModuleTabs.getClassFolder | HTML module tabs reporter class definition file location |
copy | Create copy of reporter object and make deep copies of certain property values |
getImpl | Get implementation of reporter |
Examples
Report Simulink Model Diagrams as a Tabbed Image Gallery
This example generates a single-file HTML report that has a separate tabbed panel for each system diagram of a Simulink® model.
This example requires Simulink and Simulink Report Generator™.
Run the following command to access the supporting files used in this example.
openExample('rptgenext/SimulinkReportGeneratorFilesExample');
Create the report and a chapter.
rpt = slreportgen.report.Report("MyReport","html-file"); open(rpt); ch = mlreportgen.report.Chapter("sf_car System Diagrams Tabbed Image Gallery");
Load the model and find all the diagrams in the model.
model_name = "sf_car";
load_system(model_name);
finder = slreportgen.finder.DiagramFinder(model_name);
results = find(finder);
Create an mlreportgen.report.HTMLModuleTabs
reporter to contain tabs
that correspond to the diagrams. Specify the tab labels and content for each system
diagram. The tab label is the system name. The tab content is the system diagram
snapshot.
moduleTabs = mlreportgen.report.HTMLModuleTabs(); for result = results moduleTabs.TabsData(end+1).Label = result.Name; diag = result.getReporter(); moduleTabs.TabsData(end).Content = mlreportgen.dom.Image(diag.getSnapshotImage(rpt)); end
Add the HTMLModuleTabs
reporter to the chapter and add the chapter to
the report. Close and view the report.
add(ch,moduleTabs); add(rpt,ch); close(rpt); rptview(rpt);
The report opens with the content of the first tab visible. The first tab contains the top-level diagram of the model. To see a different diagram, click the corresponding tab.
Create Tabbed Panels with Different Types of Content
This example generates tabbed panels where each panel contains a different type of content. The example also shows how to include multiple DOM objects in the content of a tabbed panel by grouping the DOM objects in an mlreportgen.dom.Group
object.
Create a report and a chapter.
rpt = mlreportgen.report.Report("MyReport","html"); open(rpt); ch = mlreportgen.report.Chapter("Tabs with Different Types of Content");
Create an HTMLModuleTabs
reporter and specify the label and content for each tabbed panel. For the last panel, create a Group
object that contains a paragraph and a table.
% Create group from a paragraph and a table p = mlreportgen.dom.Paragraph('This is a table:'); t = mlreportgen.dom.Table(magic(2)); grp = mlreportgen.dom.Group; append(grp,p); append(grp,t); % Create cell arrays for the labels and content labels = {'Text','Paragraph','Link','List','Image','Group'}; content = {"This tab contains text as a string.",... mlreportgen.dom.Paragraph('This tab contains content using a DOM Paragraph.'),... mlreportgen.dom.ExternalLink("http://www.mathworks.com/","MathWorks"),... mlreportgen.dom.UnorderedList(["Coffee", "Tea", "Milk"]),... mlreportgen.dom.Image(which("ngc6543a.jpg")),... grp}; % Create a structure from the labels and content tabsdata = struct('Label',labels,'Content',content); % Create the HTMLModuleTabs reporter modTabsObj = mlreportgen.report.HTMLModuleTabs('TabsData',tabsdata);
Add the HTMLModuleTabs reporter to the report. Close and view the report.
add(ch,modTabsObj); add(rpt,ch); close(rpt); rptview(rpt);
The report opens with the content of the first tab visible.
Click the Group tab to see that it contains a paragraph and a table.
Version History
Introduced in R2020a
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)