This is machine translation

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

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

Create Report Content

Use the Report API and Document Object Model (DOM) API to create report content

You can use the Report API and the DOM API to create MATLAB® programs to generate reports. You can create a program that specifies all of the report content and formatting or you can use your report program with a template. To get started, see Create a MATLAB Report Interactively and MATLAB Report Generator APIs.

To share your completed report generation program with others who do not have MATLAB installed on their systems, see Compile a Report Program.

Functions content to report report template holes Open generated report file in viewer Opens the report Close and generate report report template class derived from Report class Generate temporary report file name Check if Word report Check if multifile HTML report Check if single-file HTML report Check if PDF report Get report context value Set report context value
mlreportgen.dom.Document.appendAppend DOM or MATLAB object to document
mlreportgen.dom.Paragraph.appendAppend content to paragraph
mlreportgen.dom.ExternalLink.appendAppend custom element to external link
mlreportgen.dom.LinkTarget.appendAppend content to link target
mlreportgen.dom.Paragraph.cloneCopy paragraph object
mlreportgen.dom.Document.openOpen document
mlreportgen.dom.Document.closeClose document
rptviewDisplay DOM report
mlreportgen.dom.Document.createTemplateCreate DOM template file
zipTemplatePackage DOM HTML and PDF template in zip file
unzipTemplateUnzip zipped DOM template
mlreportgen.dom.MessageDispatcher.getTheDispatcherReturn DOM message dispatcher
mlreportgen.dom.MessageDispatcher.dispatchDispatch DOM status message
mlreportgen.dom.ProgressMessage.formatAsHTMLWrap message in HTML tags
mlreportgen.dom.ProgressMessage.formatAsTextFormat message as text
mlreportgen.dom.ProgressMessage.passesFilterDetermine if message passes filter
mlreportgen.dom.Document.packageAdd OPC part files to document package
mlreportgen.dom.Document.getCorePropertiesGet document or template core properties
mlreportgen.dom.Document.setCorePropertiesSet OPC core properties of output document or template
mlreportgen.dom.Document.getMainPartPathReturn path of main part of document output package
mlreportgen.dom.Document.getOPCMainPartReturn main part of document, document part, or template
mlreportgen.dom.Document.getImagePrefixGet generated image name prefix

Classes Superclass for report creation Page layout of report page reporter of contents reporter Chapter reporter Section reporter reporter image reporter Create table reporter reporter Create a MATLAB Reporter Layout for reporter Inline content hole reporter
mlreportgen.dom.DocumentDocument container
mlreportgen.dom.TextText object
mlreportgen.dom.ParagraphFormatted block of text (paragraph)
mlreportgen.dom.HeadingHeading paragraph using variable level
mlreportgen.dom.Heading1Create Heading1 paragraph
mlreportgen.dom.OrderedListCreate ordered list
mlreportgen.dom.UnorderedListUnordered (bulleted) list
mlreportgen.dom.ListItemCreate item for ordered or unordered list
mlreportgen.dom.TableCreate table
mlreportgen.dom.FormalTableFormal table
mlreportgen.dom.MATLABTableMATLAB table
mlreportgen.dom.ImageCreate image to include in report
mlreportgen.dom.TOCCreate placeholder for generating table of contents
mlreportgen.dom.PageRefCreate placeholder for reference to page number of link target
mlreportgen.dom.StyleRefPlaceholder for reference to content with specified style name or outline level
mlreportgen.dom.Heading2Create Heading2 paragraph
mlreportgen.dom.Heading3Create Heading3 paragraph
mlreportgen.dom.Heading4Create Heading4 paragraph
mlreportgen.dom.Heading5Create Heading5 paragraph
mlreportgen.dom.Heading6Create Heading6 paragraph
mlreportgen.dom.ListStyleTypeBullet or number style for HTML and PDF output
mlreportgen.dom.HorizontalRuleHorizontal line between report content
mlreportgen.dom.LeaderLeader character for PDF output
mlreportgen.dom.GroupGroup of document objects
mlreportgen.dom.CorePropertiesOPC core properties of document or template
mlreportgen.dom.MessageDispatcherDOM message dispatcher
mlreportgen.dom.MessageEventDataHolds message triggering message event
mlreportgen.dom.MessageFilterFilter to control message dispatcher
mlreportgen.dom.DebugMessageDebugging message
mlreportgen.dom.ErrorMessageError message
mlreportgen.dom.ProgressMessageProgress message
mlreportgen.dom.WarningMessageWarning message
mlreportgen.dom.OPCPartDocument part to include in OPC package

Examples and How To

Report Creation Basics

Create a Report Program

The MATLAB Report Generator™ includes sets of objects that allow you to generate Word, HTML, and PDF reports programmatically.

Construct a Report API or DOM API Object

The Report API and DOM API include a set of MATLAB functions, called constructors, for creating objects of various types, or classes.

Import the API Packages

MATLAB Report Generator function names, include either an prefix or an mlreportgen.dom prefix.

Create a Report API Object to Hold Content

Every Report API program must create an object to hold report content.

Create a DOM Document Object to Hold Content

If you intend to use the DOM API alone (i.e., without using Report API objects) to generate a report, you must create an mlreportgen.dom.Document object to hold the report content.

Add Content to a Report

The Report API add method allows you to add content to reports, chapters, sections, tables, and other Report API objects that serve as containers for report content.

Use Dot Notation for Object Properties

One way to specify the property of a object is to use dot notation.

Clone a DOM Object

You can append the same object once in a program.

Add Content as a Group

You can use a group to include the same content in different parts of a report.

Close a Report

The last step in creating a report with the DOM API is to close the report.

Display a Report

The Report API and DOM API rptview functions allow you to display a generated report in an appropriate viewer: If an HTML report is in zipped format, rptview unzips a copy of the report in your temporary folder and displays the report's main HTML document in your default system browser.

Manage a Report

Stream a Report

The DOM API supports two modes of appending content to a document:

Display Report Generation Messages

The DOM API includes a set of messages that can display when you generate a report.

Compile a Report Program

If the MATLAB Compiler™ product is installed on your system, you can use it to compile your DOM-based report generation program.


MATLAB Report Generator APIs

MATLAB Report Generator provides two report generation APIs: the DOM API and the Report API, which is based on the DOM API.

Report Packages

A Microsoft® Word document packages all its contents, text, images, style sheets, and so on, in a single compressed .docx file.

Was this topic helpful?