MATLAB: Reportgenerator Template/Styles Matlab 2018b

MATLABMATLAB Report Generatorreportgeneratortemplates

Hello,
I am trying to include a Style template into my PDF report. When I create a section I use
– TemplateSrc, 'mytemplate'
as parameter.
For mytemplate I took the 'default PDF template' from the report generator GUI. To get it I did that:
Report Explorer (Generator) -> Edit Document Conversation Template -> Default PDF Template -> Copy Template
If I try to use it directly I get the error: Section 1 not found.
So i unzip the default template.pdftx and look into the html files. The only section I can find is:
<dptemplate name="rgSect1Title">
<h2 class="rgSect1Title" style="counter-increment:sect1; counter-reset:sect2">
<hole id="prefix" default-style-name="rgSect1TitlePrefix">prefix</hole>
<hole id="number" default-style-name="rgSect1TitleNumber">number</hole>
<hole id="text" default-style-name="rgSect1TitleText">title</hole>
</h2>
</dptemplate>
So I renamed my section to sect with
– TemplateName, 'Sect'
and after that did not work I tried to rename the Sect in the html file to Section. Nothing worked so far. If I set it to Section1 I can generate the report but the Section1 does not show. Maybe the hole ids, styles or what so ever is not set correctly.
So I am wondering how I can create a style with Matlab 2018b for counting up SectionsX within the template correctly.
Thanks a lot
Martin

Best Answer

Hi Martin,
It looks like you are using the Report API to create report, but using the Report Explorer application to create the custom template.
In Report API, each reporter has its own default template whose copy can be created by using the reporter's createTemplate() method. For example, if you want to create a copy of the Section reporter's default template, use mlreportgen.report.Section.createTemplate method.
Thanks,
Rahul