Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bullet points - strange formatting #2147

Closed
magdalenadrafiova opened this issue May 30, 2019 · 25 comments
Closed

Bullet points - strange formatting #2147

magdalenadrafiova opened this issue May 30, 2019 · 25 comments
Assignees

Comments

@magdalenadrafiova
Copy link

When user downloads the plan - the bullet points appear to be strange, see image below.
Would you be able to look into what have triggered this and find a fixture for this?

bullet-points

@johnpinto1
Copy link
Contributor

Unable to replicate on Live or Test servers. @magdalenadrafiova is going to contact person who raised issue. It might be a specific template.
Test_Funny_characters.docx
Test_Funny_characters.pdf

@magdalenadrafiova
Copy link
Author

We have other admins now having the same issue.

They are using Chrome and the characters appear after they simply ‘download’ the template as Word and open it (no typing etc)

Let me know if we need to know something more .

@johnpinto1
Copy link
Contributor

johnpinto1 commented Jul 3, 2019

@magdalenadrafiova Is it possible to get a copy of the downloaded templates?

@magdalenadrafiova
Copy link
Author

tudelft-formatting

@briri
Copy link
Contributor

briri commented Jul 3, 2019

@johnpinto1 I would suggest looking at that particular plan's answer in the database to see if there is any odd formatting (e.g. maybe the user did a copy-paste from Word that had some extra HTML markup).

I did a quick test in DMPTool and could not replicate the issue so I think it may be related to that specific template/plan.

@johnpinto1
Copy link
Contributor

@magdalenadrafiova and @briri for that input. Will check.

@dsisu
Copy link

dsisu commented Jul 4, 2019

Hi, the .pdf downloads correctly, the word doc has the funny characters. John is looking at it now.

@johnpinto1
Copy link
Contributor

johnpinto1 commented Jul 4, 2019

The Word docx and pdf documents @dsisu provided are attached
Some_TU_Delft_test.pdf
Some_TU_Delft_test.docx

I can read the Word docx correctly on a Linux machine, but the same docx in Windows replaces a bullet point • with ∉ character. It looks like it is an issue with conversion from html to docx by the Ruby gem htmltoword. Will need some hacking to solve issue.

@johnpinto1
Copy link
Contributor

@briri It looks like the database does not store the Bullet points (explicitly) Screen shot for data used by @dsisu in plan above in the question_options table:
Selection_042

@dsisu
Copy link

dsisu commented Jul 4, 2019

We will have to think what format we want to download the options as. So, people tick boxes to select some options, what do we want these to look like in the Word doc download? If we use symbols similar to bullet points, people will imagine this is a bulleted list and may expect to be able to edit it. However it's not possible; the download isn't a bulleted list but plain text with a a bullet-like symbol in front of it. If John fixes the file so that it downloads the text as a bulleted list, then Word inserts the funny symbol in front of it, possibly to highlight it's not a list but some kind of slection. I think this is why Word is struggling. We need to figure out what do we want the selected options to download as. Maybe we could have them as text with a couple of tick symbols in front of it, to indicate these were options selected (from a list of options). Hopefully this will make sense once I've inserted some screenshots.

@dsisu
Copy link

dsisu commented Jul 4, 2019

image

@dsisu
Copy link

dsisu commented Jul 4, 2019

image

@dsisu
Copy link

dsisu commented Jul 4, 2019

Sorry guys, I don't have time to format the images, please enlarge them to read my comments on the text.

@dsisu
Copy link

dsisu commented Jul 4, 2019

What I mean by a tick symbol is something like this:
image

@dsisu
Copy link

dsisu commented Jul 4, 2019

A tick symbol would hopefully remind users that what they are downloading is not a potentially editable bulleted list but a list of selections they made when they filled in the plan.

@dsisu
Copy link

dsisu commented Jul 4, 2019

I'm going to send you the downloaded plans, which should hopefully help you work out what I mean, if the above isn't making sense.
Test_download_incl_bulletedlist.docx
Test_download_incl_plaintextwithbulletsymbols.docx

@dsisu
Copy link

dsisu commented Jul 4, 2019

I have to go now, I'll be able to respond to any queries later in the evening.

@johnpinto1
Copy link
Contributor

@briri I have identified the issue. The way the gem htmltoword package formats list in Word cases the issue. The relevant code app/views/shared/export/_plan.erb.

Selection_044

Unless I can't find a fix I guess we will need to have @sjDCC @magdalenadrafiova @xsrust and you @briri decide on @dsisu suggestion.

@benjaminfaure
Copy link
Contributor

We had this issue in DMP OPIDoR on our servers. I can confirm that this issue comes from the <li> tag being transformed as sign in the Word export.

We managed to bypass this by replacing our <ul> tag by a <ol> tag.
It's not ideal but it works fine :)

Side note : the htmltoword doesn't seem to be able to export images in <img> in a Word document. It can be an issue in the future, we had some feedback from users asking to be able to export their org logo in their plan export.

@johnpinto1
Copy link
Contributor

Thanks @benjaminfaure for this comment.

johnpinto1 added a commit that referenced this issue Oct 4, 2019
The fix was suggested by @benjaminfaure: #2147 (comment)

Changes:
Replaced <li> tag with <ol> in _plan.erb as suggested by @benjaminfaure
that <li> tag being transformed as € sign in the Word export.

Fix for issue #2147
@johnpinto1
Copy link
Contributor

johnpinto1 commented Oct 4, 2019

@xsrust pointed me to this bug with htmltoword
karnov/htmltoword#73

@johnpinto1
Copy link
Contributor

@briri @xsrust There is still an issue with Older Word versions of software. Will see if I can fix it with suggestion from @xsrust's link above.

@briri
Copy link
Contributor

briri commented Oct 4, 2019

ok. send in a separate PR. thanks @johnpinto1

johnpinto1 added a commit that referenced this issue Oct 7, 2019
updates a previous fix. This time we only apply the change suggested by
@benjaminfaure to docx.

    The fix was suggested by @benjaminfaure: #2147 (comment)

    Changes:
    Replaced <li> tag with <ol> in _plan.erb as suggested by @benjaminfaure
    that <li> tag being transformed as € sign in the Word export.

Fix for #2147.
johnpinto1 added a commit that referenced this issue Oct 23, 2019
when viewed in an old Word editor.

The fix follows the solution suggested in  the HtmlToWord bug "List item
bullets corrupted in Microsoft Word"
karnov/htmltoword#73 suggested by David
Verhasselt @dv.

Changes:
   - Firstly, removed earlier attempted fix in commit
     5ef7e05 (Fix for format issues for
     bullet points in Plan docx exports).
   - Made a copy of Htmltoword (1.1.0) xslt stylesheets functions.xslt
     and numbering.xslt and made changes suggested by karnov/htmltoword#73
   - Prepended the Htmltoword library XSLTHelper method xslt_path() in
     config/initializers/htmlto_word_xslt_helper.rb. This method ensures
     the Htmltoword library picks up the changed  numbering.xslt template instead of
     the library's version.

Fix for issue #2147.
@johnpinto1
Copy link
Contributor

Fix for this is in review and @dsisu tested the following file
Test_Bullets_2 (8).docx using an old Word editor see screen shoot
Selection_032

johnpinto1 added a commit that referenced this issue Nov 1, 2019
when viewed in an old Word editor.

The fix follows the solution suggested in  the HtmlToWord bug "List item
bullets corrupted in Microsoft Word"
karnov/htmltoword#73 suggested by David
Verhasselt @dv.

Changes:
   - Firstly, removed earlier attempted fix in commit
     5ef7e05 (Fix for format issues for
     bullet points in Plan docx exports).
   - Made a copy of Htmltoword (1.1.0) xslt stylesheets functions.xslt
     and numbering.xslt and made changes suggested by karnov/htmltoword#73
   - Prepended the Htmltoword library XSLTHelper method xslt_path() in
     config/initializers/htmlto_word_xslt_helper.rb. This method ensures
     the Htmltoword library picks up the changed  numbering.xslt template instead of
     the library's version.
   - pinned version of htmltoword to 1.1.0

Fix for issue #2147.
@sjDCC
Copy link
Contributor

sjDCC commented Nov 5, 2019

tested this and bullets look good now. Thanks @johnpinto1 and @benjaminfaure for advice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants