How can a create a table on contents in a pdf document created using the Matlab Report Generator
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Stephen Forczyk
el 14 de En. de 2021
Comentada: Stephen Forczyk
el 15 de En. de 2021
I have successfully created a detailed PDF report using My matlab scripts and the Matlab Report Generator. I have been unable to create a Table Of Contentd. The examples shown in the matlab help. For example the script shown in the help is as follows
import mlreportgen.dom.*;
d = Document('mydoc','pdf');
open(d);
title = append(d,Paragraph('My TOC Document'));
title.Bold = true;
title.FontSize = '28pt';
toc = append(d,TOC(2));
toc.Style = {PageBreakBefore(true)};
h1 = append(d,Heading1('Chapter 1'));
h1.Style = {PageBreakBefore(true)};
p1 = append(d,Paragraph('Hello World'));
h2 = append(d,Heading2('Section 1.1'));
h2.Style = {PageBreakBefore(true)};
p2 = append(d,Paragraph('Another page'));
h3 = append(d,Heading3('My Subsection 1.1.a'));
p3 = append(d, Paragraph('My Level 3 Heading Text'));
close(d);
rptview(d.OutputPath);
This works but I can not get this to work when I use the report generator as folllows
rpt = Report(pdffilename,"pdf");
open(rpt);
Can someone provide me an example. I don't understand all the differences 'Document" and "Report"
0 comentarios
Respuesta aceptada
Rahul Singhal
el 14 de En. de 2021
Hi Stephen,
In the Report API program, I suggest to use mlreportgen.report.TableOfContents reporter to include the table of contents in the PDF report. The documentation page also contains some examples on how to use this class.
Also, this document tells more about the DOM API objects (like Document) and Report API objects (like Report).
-Rahul
Más respuestas (0)
Ver también
Categorías
Más información sobre Title Pages, Tables of Contents, Lists of Figures, Tables, and Captions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!