ObeoNetwork / M2Doc

The M2Doc technology enables the generation of Office Open XML documents from models.
http://obeonetwork.github.io/M2Doc/
Eclipse Public License 2.0
39 stars 22 forks source link

Unreadable content in generated document, by using .asImage() plus some footer elements #462

Open allbutsafe opened 2 years ago

allbutsafe commented 2 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please have a look to the support pages of our website : http://m2doc.org/support/

Current behavior

If I generate an M2Doc document with an example like the attached one (minimized to the problematic issue), then a combination of .asImage() and the footer (especially the text box in the footer) leads to a corrupt Word document. Can be fixed by Word when opening, but that’s annoying. The visible content is then as expected.

If you remove either the asImage() service usage or the text box, it works fine.

Note: I had difficulties identifying the problematic element from the footer, which originally had more elements - sometimes even the black background picture was enough to cause the issue. So it’s not limited to a textbox itself. I could provide more examples, if needed.

Expected behavior

Generation of a Word document, which is not corrupt.

Minimal reproduction of the problem with instructions

  1. Use the attached template and assign a valid e.g. .png file path to the variable before .asImage() Note that we use m2doc programmatically with our EMF based tool, so "'../../'.concat(myExternalDocumentPicture.uri)" might have to be adapted when using another Eclipse tool.
  2. Generate the document
  3. Word opens and says that it found "unreadable content" (screenshot in the template file).

What is the motivation / use case for changing the behavior?

Correct the behaviour. Identifying the problematic combination of m2doc commands and other template elements is difficult, as there is no error message.

Environment


M2Doc version: 3.2.0
Eclipse version: not fully sure, as our tool is built with Eclipse (but not by me). If needed, I can find out (which Eclipse library/part is important?)
Platform version:  Windows 11
Office: MS Word 365

Others:

Files: minimal_example.docx minimal_example.output.docx

ylussaud commented 2 years ago

The use of text areas in header/footer is a known limitation of M2Doc (see #312). For the moment a workaround can be to replace the text area with something else: table or some text with pagination.

allbutsafe commented 2 years ago

Hi Yvan, Ok, thanks. Sorry for obviously not searching thoroughly enough before.

You can probably close this issue as a duplicate.

Regards, Nils

ylussaud commented 2 years ago

Don't worry, the terminology is not very clear and you provided a test case so thank you very much.

I will leave it open for the moment. This issue is a bit tricky since it imply changing the parser of M2Doc, so I'm not sure when we will address it.