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.

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:

    mlreportgen.dom.Document.createTemplate('mytemplate','html');

    or, for a single-file HTML template,

    mlreportgen.dom.Document.createTemplate('mytemplate','html-file');

    or, for PDF,

    mlreportgen.dom.Document.createTemplate('mytemplate','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:

unzipTemplate('mytemplate')

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

unzipTemplate('mytemplate.pdftx')

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:

zipTemplate('mytemplate.htmtx')

For PDF, use the .pdftx extension:

zipTemplate('mytemplate.pdftx')

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

Functions

Classes

Related Topics

Was this topic helpful?