Contenido principal

mlreportgen.rpt2api.createReportTemplate

Copy template that contains Report Explorer and report API styles

Since R2022b

Description

path = mlreportgen.rpt2api.createReportTemplate(templatePath) creates a copy of the default PDFTX template that contains the Report Explorer and report API styles and saves it to the specified path. You can customize and use the new template in the scripts that the rpt2api function generates.

example

path = mlreportgen.rpt2api.createReportTemplate(templatePath,type) creates a copy of the default template for the document type, type, that you can use to generate reports.

example

Examples

collapse all

Create a copy of the PDFTX template that contains the default Report Explorer and report API styles, save it in the C:\myFolder folder, and name it myTemplate.

mlreportgen.rpt2api.createReportTemplate("C:\myFolder\myTemplate")
ans =
    "C:\myFolder\myTemplate.pdftx"

You can then modify the script created by the rpt2api function to use this template by setting the mlreportgen.report.Report object TemplatePath property to this path.

Create a copy of the HTMTX template that contains the default Report Explorer and report API styles, save it in the C:\myFolder folder, and name it myTemplate.

mlreportgen.rpt2api.createReportTemplate(...
"C:\myFolder\myTemplate","html")
ans =
    "C:\myFolder\myTemplate.htmtx"

You can then modify the script created by the rpt2api function to use this template by setting the mlreportgen.report.Report object TemplatePath property to this path.

Input Arguments

collapse all

File path of the template copy, specified as a character vector or string scalar.

Data Types: char | string

Report file type, specified as "pdf", "pdfa", "docx", "html", or "html-file". Each report file type corresponds to one of these template types:

Report File TypeTemplate File Type
"pdf"PDFTX
"pdfa"PDFTX
"docx"DOTX
"html"HTMTX
"html-file"HTMT

Output Arguments

collapse all

Template copy file path, returned as a string scalar. The function returns the full file path and the file name extension.

Version History

Introduced in R2022b