M2Doc can't find images embedded in description

Hi all,
I have some issues while generating documentation with M2Doc 3.2.2 and Capella 6.0.
Images embedded in description are not found by M2doc.

Capella 6.0 stores images in the subfolder images of Myproject folder. Document templates and configuration files are located in the subfolder templates.

An I/O Problem occured while reading platform:/resource/Myproject/templates/Myproject/images/image_xxxx.png: Resource ‘/Myproject/templates/Myproject/images/image_xxxx.png’ does not exist….

It seems that M2Doc adds /Myproject/templates to the URL. The right URL should be platform:/resource/Myproject/images/image_xxxx.png

You can use a relative URI:


This is the recommended way to references resources since it make you template portable, only relying on the internal structure of your project.

or an absolute URI:







Sorry Yvan,
maybe the description of the issue was not clear.
When I paste an image in the Description of a Capella element, a png image is created in the images subfolder and an absolute pathname is associated to the URL of the image properties.

M2Doc, while generating the Word file, tries to associate such absolute pathname to Eclipse project reference, but adds the template folder, generating a wrong URL to the image file.

This looks like a bug since the URI is absolute it should not be modified by M2Doc.

You have two options here:

  • replace all URI to be relative and see if the image is still found by Capella then put your genconf file in the same folder that was used by Capella to resolve the URI. Note that Capella might not resolve URIs since they use absolute URIs…
  • Create a service that remplace the MImage URI so M2Doc is able to find the image.
    • you can have a look at this service that modify MHyperLink.
  • you can use MImage.getURI() to create a new MImageImpl and replace it in the containing List.

This issue was already reported, I added a comment:

I was able to get images in the generated document by implementing the following workarounds:

  1. Replace absolute URI in Capella description with a relative URI. I think that this issue should be fixed in Capella, since when the project is shared within a team, no absolute pathnames should be used, because each member of the team will use different local configurations.

  2. Move .genconf and .docx template in Capella project root to avoid relative paths.

I found an additional issue in the generated document. It seems that M2Doc does not apply scaling parameters defined within the image properties.

M2Doc 3.2.2 use the <img src="..." width="20" height="60"> but maybe there is a bug. You can find some tests here. Let me know if you have an example that I can check.

It seems a bug.
Description is shown in Capella:

HTML source:

<p>This is a sample description</p>
<p>Logo without scaling</p>
<p><img src="images/logo_capella_big.png" /></p>
<p>Logo with&nbsp;100px scaling</p>
<p><img src="images/logo_capella_big.png" style="width: 100px; height: 41px;" /></p>

Word generated:

1 Like

OK you are using CSS styling. Clearly it should be used by M2Doc to insert the image in the docx.

I opened an issue:

Hi Yvan, it’s not me. It’s the rich text editor in Capella.

However, with all these workarounds I am able to generate docs from Capella 6.0 + M2Doc 3.2.2.
I have never had those issues with Capella 5.1 + M2Doc 3.2.1.

Some changes have probably be made to the way Capella 6.0.0 creates descriptions.

I come back to this issue I am experiencing in document generation with Capella 6.0 + M2doc 3.2.2 when images are added in the description.
Past version of Capella embedded images encoded within the model, while Capella 6.0 stores them externally in an image folder. This feature has some drawbacks. Using git each image needs to be added to version control. Moreover, since the image is referenced with absolute path in the description, the absolute path has to be removed from each image leaving relative path only.
I think that an issue has to be generated either on Capella 6.0 or M2Doc 3.2.2.

I think you can open an issue on the Capella github since this change probably impact more than M2Doc.

And I opened an issue in the M2Doc capella extensions:

If you could link the issue on the Capella side here that would be easier for me to follow discussions.