Why MATLAB Standalone application for report generation having some sections missing

33 views (last 30 days)
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.

Accepted Answer

Aneela
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

More Answers (0)

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!