You can append HTML markup or the contents of a whole HTML file to a programmatic report written with the Document Object Model (DOM) API to:
Convert an existing HTML report to a Microsoft® Word or PDF report.
You can append the HTML markup for a report to a DOM report,
which you can then generate in Word or PDF format. For example, you
can use a MATLAB®
printf statement to generate
an HTML report file, and then append that HTML file to a DOM report
to generate a PDF or Word version of the report. Another example is
to convert a report generated by Model Advisor from HTML to Word or
Add content based on HTML markup.
You can append the HTML code for a report to a DOM report, using the HTML code as a building block in a DOM report that includes other report elements.
Perform these steps to append HTML to a DOM report.
Ensure that the HTML code complies with HTML standards,
such as including beginning and end tags (for example,
Consider using a utility such as HTML Tidy.
In a DOM report, use
append HTML code or
addHTMLFile to append an HTML
file to a document or document part.
For example, this DOM code creates a Word report that displays
World, based on the HTML code that you append to the report.
import mlreportgen.com.*; d = Document('MyReport','docx'); addHTML(d,'<p style="color:blue"><b>Hello World</b></p>');
To simplify display of an HTML report, you can specify that the DOM API generate the report as a single HTML file that includes the report images.
'html-file' for the
argument for a
For details, see the
mlreportgen.dom.Document reference page.
In R2015a, the DOM API includes several enhancements to simplify creating and formatting tables.
You can use an
object in the
Style property for
ResizeToFitContents to specifies whether to
whether to resize columns to fit the widest content in a column.
You can specify an
object in the
Style property of an
The height of a row is the tallest height specified for a table entry
in that row. If no entries in the row specify a height, then the row
height is specified by the
Height property of the
Table entries can now inherit the border formatting
specified in a
TableEntriesStyle property of
You can use the
to create high-level HTML elements not otherwise supported by the
DOM API, such as
You can also use a
Container object to simulate
format inheritance in Word reports.
For details, see
You can append text and images to
For details, see
You can use the DOM (Document Object Model) API to create MATLAB programs to generate reports. The DOM API provides a set of objects for creating text, paragraphs, tables, images, lists, and other kinds of report content. When you create a report program, you can:
Produce Microsoft Word, HTML, and PDF output using the same code.
Specify formatting for report objects, such as color and bold for text objects.
Use format objects (for example,
to format report objects.
Add MATLAB data directly to report objects (for
char array to a
Use formatting and fixed content that is defined in a Word or HTML template.
Create form–based reports that contain fixed and generated content.
Modularize a report into parts for generation of reports that have repetitive elements of the same format.
For information about how to create report programs, see Document Object Model.
Generate template-driven reports much faster than in previous releases, without using Java memory.
To take advantage of these performance advantages, use one of these File format report options:
HTML (from template)
PDF (from template)
Word (from template)
For details, see Report Generation Using Templates.
You can use a zip file to package reports that use an HTML template. Zip file packaging compresses and consolidates the files. You can also package the HTML files as unzipped files or as both zipped and unzipped files.
You can use the DOM (Document Object Model) report objects in a MATLAB program along with Word and HTML fill-in-the-blanks templates that contain fixed and holes to include generated content. The report program uses report objects to generate the variable information. See Form-Based Reporting.
On Linux® and Macintosh platforms, the report output appears in Apache OpenOffice if you:
Set File format to either
Document (RTF) or
Rich Text Format
Enable View report generation
In the MATLAB Report Generator™ Preferences, the View command preference default now enables viewing the report in OpenOffice for Linux and Macintosh platforms.
For details, see Report Output Format and Stylesheet.
The MATLAB Report Generator provides basic PDF font support for:
You can use the language font map to:
Add or modify specifications for PDF font usage for supported non-English languages.
Create PDF font support for a non-supported language.
Change the default English fonts, if you do not specify a stylesheet.
The language font map specifications indicate what font to use on a specific platform (for example, Windows®) for basic report elements such as body text. For details, see PDF Fonts for Non-English Platforms.
You can use the following new components to create and format a table:
Formatting options that the Table component and its child components support include:
Text color and alignment
Row background colors
Inclusion of images
Inclusion of hyperlinks
Table cells spanning columns and rows
You can conditionally control the content or format of a table.
For more information, see Table Formatting Components.
Releases earlier than R2012a included a different Table component.
Starting in R2012a, that component is now called the
The Array-Based Table component produces the same output, and has the same properties, as it did when it was called the Table component. The Array-Based Table component converts a rectangular array into a table and inserts the table into the report.
If a report that was created in a previous release already includes a Table component, the output is the same as in previous releases. To change property values for that component in R2012a or later, use the Array-Based Table dialog box.
For PDF and HTML reports, you can use the Stylesheet Editor to position title page elements (for example, title, copyright, and images) anywhere on the front or reverse side of the title page in any order. You can specify the size, color, weight, and slant of text elements.
For details, see Modify Title Page Properties.
You can include a subscript or superscript in a paragraph, using
To display full-page images in PDF reports, set the Paper
orientation property to the new
image (PDF only) option. The following components provide
this new option:
has a Full page image (PDF only) check box, which
provides the same functionality as the
Full page image
(PDF only) property option.
Page component includes a new Display
legal notice on title page check box. Use this option to
include the legal notice, report creation date, and copyright information
on the title page of reports that use PDF or Microsoft Word format.
Reports generated using PDF output format produce better pagination, including:
Section titles are on the same page as the associated text (now section titles cannot appear as orphans at the bottom of a page).
Captions are on the same page as their associated images.
You can now export XML comparison results to the MATLAB base workspace. You can use the results data for tasks such as further analysis or incorporating into different reports.
For details, see Export Results to the Workspace in the MATLAB Report Generator User's Guide.
Any component that displays text in reports now displays the whole text, without any truncation.
in a report you can now include a link that executes a MATLAB command.
Variable component includes several new options
for specifying the content that the component displays and the table
layout that the component uses.
Setup File component includes a new Link
to external report is relative option, which makes the
link to the nested report a relative link. This feature facilitates
including a report on a Web site.
MATLAB Expression component includes enhanced error
handling code that you can easily customize (for example, the error
handling code can stop report generation, with or without displaying
an exception). The default error handling code now supports MATLAB class
exception handling, using the
Graphics Summary Table component, use the new Transpose
table check box to change the summary table rows into columns
in the generated report. Specifying this option puts the property
names in the first column and the values in the other columns.
Page component includes an additional date format
for the Include report creation date field:
Reports for comparisons of XML files have a new faster user interface, with changed parameters displayed in a separate panel for easier review. The enhanced report now has color highlighting for new and changed items.
For details, see Explore the XML Comparison Report in the MATLAB Report Generator User's Guide.
When you create or modify a stylesheet, the Report Explorer Options pane now alphabetically sorts the stylesheets and the data items in each stylesheet category.
The order in which a stylesheet or data item appears in a list may have changed from the order used in previous releases.
To provide better graphics quality in reports using the Word document format or RTF (Rich Text format) on Windows platforms, the default format for Handle Graphics® images is now Windows metafile format. The default had been black and white TIFF.
To change the image format back to the previous default of black and white TIFF, change the preferences.
The MATLAB/Toolbox Version Number component now supports options to display information based on whether a Simulink model or Stateflow chart requires a MathWorks™ product. This feature does not apply to reports on MATLAB or toolbox code.
The Image file format options for the Axes Snapshotand the Figure Snapshotcomponents no longer include Adobe® Illustrator. If you wish to integrate a MATLAB Report Generator image into Adobe Illustrator, specify a image file format supported by Adobe Illustrator, such as PDF, and then open the image file in Adobe Illustrator.
The XML comparison report has new navigation controls to step through differences in the report. You can use the toolbar buttons or the XML menu to move to the next or previous group of changes.
For details, see Explore the XML Comparison Report in the MATLAB Report Generator User's Guide.
The Report Explorer interface has a number of enhancements. The View menu has commands to increase and decrease font size and to show the message window if it is not displayed.
MATLAB Report Generator performance has improved. Reports are often generated more rapidly and with less chance of running out of memory.
The format of XML files has changed in V3.0 (R2006a).
In V3.0 (R2006a), Report Explorer and the
can convert XML files produced by the report generation process in
V2.3.1 (R14SP3) and previous versions. However, in V2.3.1 (R14SP3)
and previous versions, Report Explorer and the
cannot convert XML files produced by the report generation process
in V3.0 (R2006a).
This release adds support for modifying the content of headers and footers in PDF reports. This feature is implemented using stylesheet cells and cell groups. A cell group contains one or more stylesheet cells. A stylesheet cell is a set of values that determine the content of a particular portion of the header or footer for a page.
Two cell groups, Header Content and Footer Content, are available for PDF reports. You can use templates to specify XML code that defines the content for a header or footer.
You can use the Stylesheet Editor to customize the formatting of your HTML, PDF, and Word documents. For example, you can specify fonts, paper layout, table presentation, as well as other characteristics of your final report.
Customizing reports by editing stylesheets gives you the flexibility to create reports that conform to corporate style guidelines and requirements.
To open the Stylesheet Editor, right-click Report Generator in the Outline pane of the Report Explorer and then click Edit Stylesheet on the shortcut menu, as shown:
For more information about using the Stylesheet Editor, see Create Custom Stylesheets in the MATLAB Report Generator documentation.
You can create advanced table layouts for property tables. The advanced layouts include cells that span multiple rows or columns.
You can generate reports that are saved as Microsoft Word documents
.doc extension. You can also convert XML
source files that are generated by the report generation process to
The reports you create are easier to distribute via e-mail, to share with others, and to manage.
You must have Microsoft Word software installed to use this feature, and you must be running the MATLAB Report Generator software on a Microsoft Windows system.
To use this feature select Word Document from the Stylesheet drop-down list in the Convert Source File dialog box, as shown:
This version of the MATLAB Report Generator software has the following changes and improvements to the graphical user interface:
The File Converter has a Source File drop-down list. Click Browse to navigate to a folder to select a source file. The default folder is the current folder.
In the File Converter, you can select a stylesheet from the drop-down list and click Edit to open the Stylesheet Editor.
An improved mechanism detects and displays errors that occur when you attempt to add a component that makes the style hierarchy invalid. Users of earlier versions may notice that warnings are now issued for components that had no problems in earlier versions. In this release, warning messages contain instructions about how to fix the problem.
Figure Screen Capture component
has been improved to capture window decorations such as menus, title
bars, and toolbars.
|Release||Features or Changes with Compatibility Considerations|
|R2012a||Enhanced Table Components|
|R2006a||XML File Format Changed|