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. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Create an HTML or PDF Template

Use one of these approaches to create an HTML or PDF template for generating a report.

  • Use mlreportgen.dom.Document.createTemplate to create a copy of the DOM API default template that you can then customize. For example:


    or, for a single-file HTML template,


    or, for PDF,

  • Create a template from scratch.

Edit an HTML or PDF Template

A single-file HTML template embeds style sheets and images as HTML elements in the HTML document. An HTML template can be in a single file, with an .htmt extension, or in a zipped template package, with an .htmtx extension. PDF templates are packaged in a zipped template package, but use a .pdftx extension. To edit a single-file HTML template, open the .htmt file. To edit one of the packaged templates, unzip it to a folder using the unzipTemplate function. For example, to unzip an HTML template called mytemplate in the current folder:


Using the .htmtx extension is optional for packaged HTML templates. However, to unzip a PDF template, you must use the template extension, for example:


After you unzip the template, you can edit the .css and .html files using a text editor or an HTML editor. To learn more templates, see Templates for DOM API Report Programs.

To repackage a template after you edit it, use the zipTemplate function. For example, package the template stored in a subfolder in the current folder named mytemplate:


For PDF, use the .pdftx extension:


If you want to work with your template in a location other than the current folder, you can specify a path with the unzipTemplate and zipTemplate functions.

See Also



Related Topics

Was this topic helpful?