Reportgenerator Template/Styles Matlab 2018b

조회 수: 6 (최근 30일)
Martin Meiboom
Martin Meiboom 2020년 7월 14일
댓글: Martin Meiboom 2020년 7월 27일
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

채택된 답변

Rahul Singhal
Rahul Singhal 2020년 7월 14일
편집: Rahul Singhal 2020년 7월 14일
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
  댓글 수: 5
Rahul Singhal
Rahul Singhal 2020년 7월 16일
Hi Martin,
Actually the command-line help for TableOfContents reporter was updated in R2019a to address the TOC elements customization issue. To update the TOC elements styles, you need to update the report's template instead of the reporter templete. Below is the actual content from the TableOfContents reporter command-line help:
Styles in a report's template determine the size, spacing, color, and other format properties of the entries in a table of contents generated by this reporter. The mlreportgen.report.Report object's default Word and PDF templates define styles that determine the default format of TOC entries. The styles are named TOC1, TOC2, ... TOC6, where style TOC1 defines the format of level 1 entries, style TOC2 defines the format of level 2 entries, etc. To change the format of the entries, create a custom report template that redefines these styles and use the template to generate your report. Note that you must redefine the styles in the report template, not in the template used by this reporter.
Hope this helps!
Martin Meiboom
Martin Meiboom 2020년 7월 27일
Thanks that helped.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by