Problem viewing header image

Hello!
I am generating a report using a Word Template. The template works without problems when using it directly from MS Word. When I insert it in my code though, the image header in the generated Word file shows up as a red cross with the text "image can´t be displayed". I have tried to make the header image an inline image, so that it is on the same level as the text, but that didn´t change anything.
Here is part of the code:
import mlreportgen.dom.*;
doc = Document('Protokoll_1', 'docx', 'Template_Protokoll_1');
holeId = moveToNextHole(doc);
fprintf('Current hole ID: %s\n', holeId);
append(doc, Table_Init_1);
holeId = moveToNextHole(doc);
fprintf('Current hole ID: %s\n', holeId);
append(doc,Image('C:\Users\Konstantina\Documents\MATLAB/Bild1.png'));
close(doc);
rptview('Protokoll_1', 'docx');
Thanks in advance for your help!
Konstantina

3 Comments

There seems to an error with the image path: 'C:\Users\Konstantina\Documents\MATLAB/Bild1.png'. The last separator is a forward slash (/) instead of backslash (\). I would recommend to try again after correcting the path.
forward slash valid in Windows except for some parts of the command shells .
Thank you both for your answers!
It was actually an incompatibility issue. I was using MatLab 2014a. Once I switched to 2018b everything worked perfectly!

Sign in to comment.

Answers (0)

Asked:

on 18 Feb 2019

Commented:

on 22 Feb 2019

Community Treasure Hunt

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

Start Hunting!