Can you preview a report without closing it?

1 回表示 (過去 30 日間)
Randolph Leiser
Randolph Leiser 2024 年 12 月 3 日
コメント済み: Randolph Leiser 2024 年 12 月 4 日
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.

採用された回答

Sandeep Mishra
Sandeep Mishra 2024 年 12 月 4 日
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!
  1 件のコメント
Randolph Leiser
Randolph Leiser 2024 年 12 月 4 日
Thanks Sandeep, I appreciate your reply. It seems the fastest/cleanest way to do what I want is using copyfile and running the alternate version without interfering with the main script. I was hoping there might be a more clever way to handle this, but for my current purposes this will serve.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by