I have a code generating a full report but I want to add an image in the header so I created a template and tried out. But now the word file only gives me the name of the objects in the report and not the actual content like this:
Do anyone know where does this problem comes from? My code is
%% init
import mlreportgen.report.*
import mlreportgen.dom.*
rpt = Document('Report','docx', 'template.dotx');
moveToNextHole(rpt)
%% chapter
ChapterRegression = Chapter;
ChapterRegression.Title = 'Summary';
append(rpt, ChapterRegression)
close(rpt)
rptview(rpt)
My dotx
template just have one Rich Text Content Control
hole.
Thank you in advance!
My question has been answered on Mathwork forum. But let me sum it up here as well:
I am using the Document
object and we can not add Report API objects like TitlePage to a DOM Document. Instead and that was what I was doing at first I should use mlreportgen.report.Report
of the DOM Document. You can add both DOM and Report API objects to a Report object.
Then to use all the functions relative to the Document
object like moveToNextHole()
the Report
object has an underlying DOM Document object that can be used.
Use it like this for example:
doc = rpt.Document;
doc.moveToNextHole();