Reportgenerator Template/Styles Matlab 2018b
4 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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
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!
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Report Generator 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!