M2Doc adding multiples carriage returns at the export

Hi guys,

I’m strugling with this problem for days now and i definitely need help with this.

I’m on capella 1.4.0 with M2DOC 3.0.0.

Apparently, the HTML of elements description can’t be export correctly.

When I use the fromHTMLBodyString() property on my element description, it appears to add unwanted carriage returns into my description.

This behaviour is basically deterioring as I’m going through my loop. The more elements I have in my loop the more carriage returns i get.

Example:

Item1:


My first description is good.
I can have as many lines as I want.
It’s working

Item2:


I get a first carriage return before the beginning of the description.
\n
And if I have more lines
\n
\n
It starting to be really insane.
\n
\n
\n


I made the test with classic description {m:element.description}, this export the text with all HTML tag without any unwanted carraige return which is basically normal.

I tried to use another template, I got the same behaviour.

Have you any ideas of the problem ?

Thanks for your help

This can be a bug in the fromHTMLBodyString() service. Can you provide the HTML you are passing to the fromHTMLBodyString() service so I can have a look at this issue ?

Hi Yvan,

That was my conclusion too but I have no idea how I can counter it.

For the content it’s just regular text and list without any style.

I tried to re import the whole M2DOC package, now my doc is generated with more than 400 pages instead of 80 (with description only).

After investigating, the service is not the problem. When paragraph generated by the service are inserted, a new line or an empty paragraph is added. I opened the following bug:


I also added a test case to reproduce the issue.
1 Like

I face the same problem, that’s great you are on it ! :+1:

I found a pseudo workaround.

When generated, you can make an advance search for special characters ^| which is “manual carriage return” and replace it with nothing.

It works pretty well but its not optimal

Yes you are 100% right, it was a workaround I just found also, I only make a replacement of ^l^l by ^l

Doing this several times, I reduce the multi ^l in the docx file but in the end I will always have a ^l to still have a separation between lines.

The bug has been corrected in version 3.1.1 of m2doc.
I have managed to install m2doc 3.1.1 with capella 1.4.1 and the description fields are correctly inserted in the generated word document.

Hello
I am very interested to know how you install m2doc 3.1.1 with Capella and make the template running (they are in 3.0.0) I have lot’s of troubles, templates are no more recognized
My installation is special for I use a Virtual machine (share by several people) so the plugin are share by all too (may be this make unexpected update/change of the plugin)

is it possible to get M2Doc for Capella from here

I guess it is not capella compatible
Am I right ?

M2Doc extensions for Capella fix a given version of M2Doc to a given version of Capella. It provides a set of specific services, but if you don’t use them you can install M2Doc into your Capella. In this case you can download the needed M2Doc version form the M2Doc download page. Note that it should work, but some combinations are not tested.

ok, now when I install the 3.1.1 and try to “validate Document Template” I got

image

I was able de get ride of this warning this in the template properties (click on current version)
image

but I still have no reference to Sirius or Capella in my template properties

image

and my generated file is
image

In the “Services (expert)” tab you can remove the import of the service class, this will remove the error you show at the end. But you will not be able to call services defined in this class anymore.

Yes, I made the test removing the services, My document is build for 75% of my expectations but some features are not accessible as you guessed
Invalid query statement: Couldn’t find the ‘getCeDirection(EClassifier=ComponentExchange,EClassifier=LogicalComponent)’ service

Yes the service getCeDirection() is defined in the extension plug-in. The M2Doc extensions for Capella shoud be refactored to support several versions of M2Doc and Capella. This way one could install it in different contexts.

For the service, you can either implement it in your own plug-in if you are familiar with Eclipse plug-in development or find an AQL equivalent, something like:

(ce.sourcePort + ce.targetPort)->select(p | p.eContainer() = sourceComponent)->filter(fa::ComponentPort).orientation.toString()

Where ce is your ComponentExchange and sourceComponent is your Component.

This is definitively out of my skill level :persevere:
but I am interested only for the include of picture and the multiples CR problem, as I found workaround I will live with this until a official delivery of M2Doc version 3.1.1 for Capella.

M2Doc extensions for Capella 5.0.0 is based on M2Doc 3.1.1 if you can upgrade your Capella.