karnov / htmltoword

Ruby html to word gem
MIT License
179 stars 71 forks source link

Can't render images on the document #80

Open eviofragoso opened 5 years ago

eviofragoso commented 5 years ago

I'm trying to render images on the docx, but with no success. I even tried with the example in the readme and the images just dont appear.

The image html i'm trying to render is: <p style='text-align: center;'><img src=\"http://placehold.it/250x100.png\" style=\"width: 250px; height: 100px\"></p>\n ... rest of the html.

using this call in the controller: render docx: "document.docx", content: document_html

I'm using the 1.1.0 version of the gem, with 5.0.2 rails version.

TiagoHenriqueMoraes commented 5 years ago

+1

jcat4 commented 5 years ago

+1 as well...

anitsirc commented 5 years ago

@eviofragoso could you share more details?

Just tried

content = "<p style='text-align: center;'><img src=\"http://placehold.it/250x100.png\" style=\"width: 250px; height: 100px\"></p>"
render docx: "test-file", content: content

And seems to be working fine

Screenshot 2019-11-08 at 18 27 26
HugsDaniel commented 2 years ago

Hi folks, any progress on this issue ? I encounter the same, no way to display images even with all the required style and data tags.

jcat4 commented 2 years ago

Hi folks, any progress on this issue ? I encounter the same, no way to display images even with all the required style and data tags.

Unfortunately, I don't think we found a solution to this problem using this gem. We ended up parsing the HTML with Nokigiri and building a docx file with caracal. A little more involved, but.... It works! 👍

adamreisnz commented 4 months ago

I can confirm that even using the placeholder image code as suggested above by @anitsirc , no images are rendered in the DOCX file output.

mohamed-ali-agourram commented 1 month ago

I can confirm that even using the placeholder image code as suggested above by @anitsirc , no images are rendered in the DOCX file output.

Hi did you find any solution for this yet?