DMPRoadmap / roadmap

DCC/UC3 collaboration for a data management planning tool
MIT License
106 stars 109 forks source link

Export to docx not working #217

Closed sjDCC closed 7 years ago

sjDCC commented 7 years ago

For some reason, completed answers aren't pulling through to the docx export anymore. The document is created and unanswered questions are marked, but any responses users have added aren't added.

Information from text boxes and text fields doesn't pull through but dropdown answers do. From initial tests it doesn't seem to be affecting all templates / plans equally. Legacy data exports ok as far as I can tell, and default templates are the ones primarily affected.

This is a current issue for live services, hence prioritising

benjaminfaure commented 7 years ago

Hello, We had this issue on DMPOPIDoR, it seems that text fields weren't displayed at all in the docx export.

I think this issue should be resolved in the pull request I made for the date question format : https://github.com/DMPRoadmap/roadmap/pull/92/files#diff-af0660cd0c2c6dd6424fbc0c1aa46634

sjDCC commented 7 years ago

Thanks Benjamin. We'll take a look. S

vyruss commented 7 years ago

I can confirm that the fix appears to work.

vyruss commented 7 years ago

Blocked by #222 in Roadmap

raycarrick-ed commented 7 years ago

Melbourne and Tuuli were both not exporting text_areas properly to docx. Same fault in current Roadmap. Fixed in https://github.com/DigitalCurationCentre/roadmap/commit/71345bd5ba16efa9bf0ef78a6ddd08247a135141

stephaniesimms commented 7 years ago

All answer text is now exported in DOCX but problems remain:

  1. All question text is exported too (screenshots below). Only answers should be exported.
  2. Text entered in tables and lists appears as plain text AND in the designated table or list form (screenshots below).

screen shot 2017-04-10 at 8 42 35 pm

screen shot 2017-04-10 at 8 42 54 pm

sjDCC commented 7 years ago

Hi @stephaniesimms I don't think this is right. We do want questions to be exported as well as answers. The example you've tested here is a bit odd as usually there wouldn't be so much text in the question, but we don't only want answers. They wouldn't make sense in isolation...

In this example the extended question text seems a bit like guidance, but it's not.

The duplication of exported text as plain text and in its designated form is definitely wrong though

stephaniesimms commented 7 years ago

@sjDCC We don't export questions in DMPTool. For one reason, they pose issues when there are page limits for DMPs. I didn't realize this is expected for DMPonline. We can talk about customizing this for our instance if necessary.

sjDCC commented 7 years ago

Or maybe we should trial removing them? What do you export to give it structure - just section headings? That may be sufficient. @stephaniesimms

stephaniesimms commented 7 years ago

Yes @sjDCC - just section headings. You can take a look at any of the PDFs from the public DMPs list: e.g., https://dmptool.org/plans/8273.pdf The public plans come with a cover sheet to provide clarity about copyright concerns mainly. The layout looks very similar for DOCX export but has always been less attractive because Word.

raycarrick-ed commented 7 years ago

Going to change docx exporting to use htmltoword rather than caracal as it is likely to work better. Not addressing the customisation need for DMPTool to not print questions. New issue #240 for that

raycarrick-ed commented 7 years ago

Change to htmltoword in https://github.com/DigitalCurationCentre/roadmap/commit/6909f0982ce8e5468a8a6f9dc5a802c7d0e224ee

vyruss commented 7 years ago

DOCX output not valid, moving back to Review for fix

xsrust commented 7 years ago

I exported a horizon 2020 plan and it successfully downloaded a file, but i got an error from word saying that file cannot be opened:

image

sjDCC commented 7 years ago

Was this on your local dev environment @xsrust? It's currently working on UC3 staging and on the live Tuuli service.

@vyruss is this issue happening because the Tuuli fix you made is incompatible with the new roadmap code?

We perhaps need to revert to Ray's earlier code here if that's what's deployed currently.

xsrust commented 7 years ago

yes it was on my local dev environment. I didnt try it on any of the other servers

vyruss commented 7 years ago

@sjDCC No, this is not the Tuuli hack. This is a one-liner fix to Ray's implementation for Roadmap. It works on dmponline-test too. @xsrust can you open it on Word Online?

xsrust commented 7 years ago

not working on Office365 online either. it asks to be opened locally since something went wrong and then throws the same error. This is again off of my local machine but i dont think there should be any difference between that and dmponline-test.

xsrust commented 7 years ago

ok. I am able to export the horizon2020 template on dmponline-test if i do not export any of the sections for the first phase. the second and third phases work fine with all sections selected.

vyruss commented 7 years ago

Cannot replicate, it works for all phases with me @xsrust.

stephaniesimms commented 7 years ago

I can export an empty DOCX file and open it. However, when I select any content (plan details or sections/answers) I get an error when I try to open the file. It appears to be the same error that @xsrust reported above (screenshot).

export-docx

sjDCC commented 7 years ago

Have trialled this on DMPonline test with plan details and answers selected and export works fine. Can't login to staging currently

sjDCC commented 7 years ago

I have done some further testing and can now replicate this on Roadmap-staging and DMPonline-test.

It seems to be limited to the H2020 template and specifically sections with questions that include html tags. I got the error on various docx exports for the initial phase. However, if I chose to export sections that don't include html tags in the question area (e.g. plan details and the final 'other' section) the docx would open as normal.

@dsisu and @stephaniesimms Do you want to double check this? Perhaps trial other templates to ensure I'm right that it's an error isolated to H2020?

sjDCC commented 7 years ago

Hmmm, one thing I've just noticed, plan details seem to be exported irrespective of whether they're selected or not. @dsisu can you check this and if so, raise a new ticket to report the bug. I'm just about to board a train so will have flaky wifi for next few hours

dsisu commented 7 years ago

Trying to export plan based on H2020 template from dmponline-test in docx format gives error below: h2020docxerror

dsisu commented 7 years ago

Tested exporting AHRC template in docx format from dmponline-test. It works.

I noticed an error that ocurred during editing: if you insert an answer in table format, the table editing window does not shut down once you've saved the answer. I'll have to test this more.

dsisu commented 7 years ago

@sjDCC I can't replicate the export plan details error. Tried it in both dmponline live and dmponline-test

sjDCC commented 7 years ago

Ok, a note to clarify the remaining issue for devs. Docx export isn't working in the context of H2020 alone. All other templates are ok. Should I drag this back to pending or in progress or start a new ticket @vyruss?

A plan details export bug does exist too. I started a new ticket for this #295 What's exported isn't consistent with what is selected in the settings. Problem is limited to a few formats.

vyruss commented 7 years ago

@sjDCC I think this should become a new issue as there's probably some invalid HTML in the H2020 template which is breaking the export. Since everything else seems to work, I'd close this one.

sjDCC commented 7 years ago

Ok, have opened it as a new issue #297