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:
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 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:
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.
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:
<p>This is a sample description</p>
<p>Logo without scaling</p>
<p><img src="images/logo_capella_big.png" /></p>
<p>Logo with 100px scaling</p>
<p><img src="images/logo_capella_big.png" style="width: 100px; height: 41px;" /></p>
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.