
I failed to export diagrams in requirement text, what does the error message mean and how to solve it?

Maybe there is a problem with the URI encoding. You can try to remove the white space in “Service Library”. “Service Library” is a project in your workspace ? Maybe you can try with a relative path on your file system ?
Also “platform:/resource” URIs won’t work outside of Eclipse.
@YvanLussaud
Thank you! I change the location of the template from the folder to directly under the project, and use replaceAll() function to replace the extra prefix of the URI so that the image can be located.
Another question. How to resize the picture. It’s too big now, and the fit() function won’t work.
You will need to write a service to navigate MElement and resize MImage. The service replaceLink() navigates MElement if you need a starting point.
Thank you!
Another question, could I define selection as a variable in the template, and each generation result depends on which element I select?
Your method is interesting, you should only set one of the two dimension if possible to keep aspect ratio.
Yes you can use a variable of your template to bind a different value in different .genconf files. After that you can use an if statement to check is a block of code should be generated or not. You can also define a template construct to create a function that will generate part of the document and can be called like a service. There are some examples in the unit tests.
Hello everyone,
I know this topic is old but I have the same kind of issue.
I tried to use replaceAll() in my query but there is no change in the result for the image’s path.
Thanks in advance.
Hi Souail,
You need make sure the resulting relative path can resolve to your image from the template location.
it should probably look something like this ../../<capella project name>/images/....
Or you can move the template at the root of your Capella project even if it might not be the best way to resolve this issue.
Hi Yvan,
Just to be sure, replaceAll() should work to modify the path of an image ?
In my case, /M2Doc_Template/M2Doc/Templates/M2Doc_Template/images/20250425_101757_938297.png should become ../../images/20250425_101757_938297.png to access the image from the template location.
However, I think replaceAll() doesn’t work in my query because the result path is the same :
You need to check the path in the HTML text. The error message shows the path already resolved from the template path.
Another way to fix this might be to provide the base URI when converting the HTML (see this service).
Thanks Yvan, It works with the following query.
selection.ReqIFText.replaceAll('M2Doc_Template/', '../../').fromHTMLBodyString()
PS : To see the HTML text, the Sirius interpreter can be used.
Yes the M2Doc interpreter view render the result as HTML and interpret the HTML string…