How can I insert a figure into a report?

38 ビュー (過去 30 日間)
Gebhard Stopper
Gebhard Stopper 2018 年 7 月 6 日
コメント済み: Sean de Wolski 2020 年 5 月 4 日
I'm trying to use the report generator and automatically build a PDF report. For that, I've been following the object oriented approach, and created a template with holes plus corresponding classes derived from mlreportgen.dom.Document and mlreportgen.dom.DocumentPart. Some of the holes i'd like to fill should receive figures with graphs or small images. However, in my report, I only find [1x1 mlreportgen.report.Figure] insted of the figures.
function fillsignalHeatmap(chapter)
f = figure();
MHeatMap.DrawHeatMap('Data', chapter.ResultSet.Results, 'Parent', f); %renders a heatmap to a given figure
chapter.append(mlreportgen.report.Figure(f)); % chapter is derived from mlreportgen.dom.DocumentPart
end
What am I doing wrong here?
Cheers, Gebhard

採用された回答

Sean de Wolski
Sean de Wolski 2018 年 7 月 6 日
You can't append a high level "report" element ( mlreportgen.report.Figure) to a low level "dom" element ( mlreportgen.dom.DocumentPart).
Either create an mlreportgen.report.Chapter and add() the Figure to that OR print the figure to an image and append() the mlreportgen.dom.Image to the DocumentPart. I'd typically recommend the former.
  3 件のコメント
Oliver Warlow
Oliver Warlow 2020 年 5 月 4 日
Hi Sean,
I have come acros this same problem but can't seem to get your solution to work.
I hve a dotx template open as as "D" and am trying to add a figure to a hole as follows:
fh = surf(peaks)
chap = Chapter('figureChapter')
add(chap, Figure)
append(D, chap)
however I just get the same as the original post [1x1 mlreportgen.report.Chapter]
Any ideas?
Sean de Wolski
Sean de Wolski 2020 年 5 月 4 日
Hi Oliver,
A Chapter is a high-level report object. It cannot be appended to the Document created with D. You either need to use the report API for the report (pulling in the template) or use only lower level DOM components.
I'd recommend asking a new question with all of the detail.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeReport Generator Creation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by