Can you preview a report without closing it?

20 Ansichten (letzte 30 Tage)
Randolph Leiser
Randolph Leiser vor etwa 18 Stunden
Beantwortet: Sandeep Mishra vor etwa 2 Stunden
I would ideally like to regularly preview the appearance of a report without needing to regenerate the entire thing, however executing rptview() closes the report so it can no longer be edited.
Any report based object (report, chapter, etc) seems to use the same pointer since modifying one modifies both, so something like below would not work, as it closes both reports.
rpt2 = rpt;
rptview
In theory you could generate two parallel reports, but attempting to append the same object to multiple reports leads to an error as well.
import mlreportgen.report.*
import mlreportgen.dom.*
rpt = Report('test 1','pdf');
rpt2 = Report('test 2','pdf');
tp = TitlePage;
tp.Title = 'Title';
append(rpt,tp);
append(rpt2,tp);
Error using mlreportgen.report.ReporterBase/getImpl
Cannot add this reporter to report /test 2.pdf because it has also been added to report
/test 1.pdf.
In which case you'd have to make separate instances of everything you want to add to the report.

Antworten (1)

Sandeep Mishra
Sandeep Mishra vor etwa 2 Stunden
Hi Randolph,
I noticed that you are using MATLAB Report Generator to generate reports in PDF format and want to perform the following two tasks: preview the report without closing it and append the same object to multiple reports.
Addressing your first query:
Regarding the second query:
import mlreportgen.report.*
function tp = createTitlePage(titleText)
import mlreportgen.report.*
tp = TitlePage;
tp.Title = titleText;
end
% Create and use title pages in reports
rpt1 = Report('test1', 'pdf');
append(rpt1, createTitlePage('Title for Report 1'));
rpt2 = Report('test2', 'pdf');
append(rpt2, createTitlePage('Title for Report 2'));
I hope this helps you in resolving your queries!

Produkte


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by