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
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:
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.
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.
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.