DMPbelgium / roadmap

5 stars 1 forks source link

DMPOnline creates an invalid .docx document #58

Closed StCyr closed 1 year ago

StCyr commented 2 years ago

Please complete the following fields as applicable:

What version of the DMPRoadmap code are you running? (e.g. v2.2.0) https://dmponline.be

Expected behaviour: MS Office can open all .docx document generated by DMPOnline

Actual behaviour: The "Horizon Europe DMP+" template generates plans that cannot be exported as MS Office compatible .docx files

Steps to reproduce:

Additional information If you modify (a copy of) this template and try to delete some sections, you will see that you'll need to delete them twice; It's like those sections where 2 times in the template

TheLisaVL commented 1 year ago

The issue seems to have been caused by the use of bullet points in the question text. When you take those out and replace them with newlines, it opens in word without issue.

nicolasfranck commented 1 year ago

Also happens on test.dmponline.be (more recent version).

e.g. https://test.dmponline.be/plans/65251

nicolasfranck commented 1 year ago

cf. https://github.com/karnov/htmltoword/issues/73 cf. https://github.com/DMPRoadmap/roadmap/issues/2147 cf. https://github.com/DMPbelgium/roadmap/blob/master/config/initializers/htmlto_word_xslt_helper.rb

nicolasfranck commented 1 year ago

apparently the ending </strong> is not added after the question text, but a bit further after </ul>. Moving that ending </strong> back to the end of the question text "solves" this.

<strong>question title<br>
<ul>
<li>yes</li>
<li>no</li>
</ul>
</strong>

See https://github.com/DMPRoadmap/roadmap/blob/master/app/views/shared/export/_plan.erb#L45 See https://github.com/karnov/htmltoword/issues/73

Removing the <br> (and keeping </strong> at the end) helps too

nicolasfranck commented 1 year ago

Causes:

nicolasfranck commented 1 year ago

See https://github.com/DMPRoadmap/roadmap/issues/3221

nicolasfranck commented 1 year ago

@laurastandaert any idea where these kind of question originate from? Question with bullet points in the question text seems like something that could be fixed just by using a select question, not?