Main Content

mlreportgen.dom.Document.createTemplate

Class: mlreportgen.dom.Document
Namespace: mlreportgen.dom

Create DOM template file

Description

templatePath = mlreportgen.dom.Document.createTemplate(path) creates a copy of the default DOM template at the specified location and returns the full path of the new template. The path argument must include a file name extension that indicates the type of template to create.

templatePath = mlreportgen.dom.Document.createTemplate(path,type) creates a copy of the DOM default template of the specified type at the specified location and returns the full path of the new template.

example

Input Arguments

expand all

Path, including the file name, of the new template file, specified as a character vector or string scalar. If you use the path argument without the type argument, include the file name extension:

  • .dotx or .docx for Word

  • .htmtx or .htmx for HTML

  • .htmt or .html for single-file HTML

  • .htmtx or .htmx for multipage HTML (since R2024a)

  • .pdftx or .pdf for PDF

  • .pdftx or .pdf for PDF/A (since R2025a)

If you use both the path and type arguments the mlreportgen.dom.Document.createTemplate method ignores the file name extension in the path argument.

Type of template, specified as:

  • "docx" for Word

  • "html" for HTML

  • "html-file" for single-file HTML, consisting of a single file that contains the text, style sheets, JavaScript®, and images for the report

  • "html-multipage" for multipage HTML (since R2024a)

  • "pdf" for PDF

  • "pdf" for PDF/A (since R2025a)

Output Arguments

expand all

Full path of the template copy, specified as a character vector or string scalar. The path includes a file name extension:

  • .dotx for Word

  • .htmtx for HTML

  • .htmt for single-file HTML

  • .htmtx for multipage HTML (since R2024a)

  • .pdftx for PDF

  • .pdftx for PDF/A (since R2025a)

Attributes

Statictrue

To learn about attributes of methods, see Method Attributes.

Examples

expand all

Create a Microsoft® Word template file in the current folder.

mlreportgen.dom.Document.createTemplate("MyWordTemplate","docx");

Limitations

HTML templates do not support character entity references. To specify an entity, enter the equivalent numeric character reference.

Version History

Introduced in R2014b