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.

createTemplate

Class: mlreportgen.report.BaseTable
Package: mlreportgen.report

Create table template

Syntax

template = createTemplate(templatePath,type)

Description

template = createTemplate(templatePath,type) creates a copy of the default table reporter template specified by type at the location specified by templatePath. You can use the copied template as a starting point to design a custom table template for your report.

Input Arguments

expand all

Location of the reporter template, specified as a character vector, character array, or template source object.

Format for the output, specified as 'html', 'html-file''docx', or 'pdf'. If you specify a template using the templatePath property, the value for type must match the template type.

Output Arguments

expand all

Name of template, returned as the path and file name of the template. The template file name extension is assigned based on the specified output type. For example, for PDF output, the template name has a .pdftx file extension.

Examples

Create Title Page Template

Before you run this example, create a copy of the default HTML BaseTable template in the mytemplates folder. Name the copied template myTable.htmtx. Edit the template as desired. To use the new template for the title page, assign its path to the BaseTable TemplateSrc property.

import mlreportgen.report.*
rpt = Report('My Report','html');
table = BaseTable(magic(5));
table.Title = 'Rank 5 Magic Square';
template = BaseTable.createTemplate('mytemplates\myTable','html');
table.TemplateSrc = template;

Introduced in R2017b

Was this topic helpful?