Why MATLAB Standalone application for report generation having some sections missing
33 views (last 30 days)
Show older comments
okoth ochola
on 1 Nov 2024 at 3:33
Hello, May I make a quick enquery about report generation in stand alone application. I have written some code that should generate report, which works very well when in MATLAB. However, after compiling into a standalone application, the standalone application generates a report with no table of contnets and the all figures have the same figure numbering. That is, all figures have been numbered 'Figure 1.1' which is undesired. How can I solve this, is there some commands I have missed or files that I need to add to the code before compiling? Note that before my code I had makeDOMCompilable() command which I thought should be able to solve the problem but unfortunately, it didnt.
0 Comments
Accepted Answer
Aneela
on 3 Nov 2024 at 18:53
I understand that you are trying to generate a report using a standalone application and encountered that the report generated using standalone application did not include Table of Contents.
I was able to reproduce the issue when I specified the report format as 'docx', which did not include Table of contents. However, I compiled another standalone application by specifying the report format as 'pdf'. This 'PDF' report included table of contents.
You can use the below code for reference:
function report
makeDOMCompilable();
import mlreportgen.report.*
import mlreportgen.dom.*
rpt = Report('Report with TOC');
add(rpt, TitlePage(Title='Report',Subtitle='with TOC'));
toc = TableOfContents;
toc.Title = Text('Table of Contents');
toc.Title.Color = 'green';
toc.NumberOfLevels = 2;
add(rpt,toc);
ch = Chapter('First Chapter');
add(ch,Section('First Subsection'));
add(ch,Section('Second Subsection'));
add(rpt,ch);
add(rpt,Chapter('Second Chapter'));
add(rpt,PDFPageLayout);
p = Paragraph('Appendix');
p.Style = {OutlineLevel(1), Bold, FontSize('18pt')};
add(rpt,p);
close(rpt);
rptview(rpt);
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Title Pages, Tables of Contents, Lists of Figures, Tables, and Captions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!