karnov / htmltoword

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

How Paste image to docx #66

Closed webdev-rc closed 6 years ago

webdev-rc commented 6 years ago

I try paste image

@thumb = '<img src="http://www.fips.ru/rutmimage/0/200000/270000/270000/270041-s.JPG" border="0">'.to_html

as raw (this is HAML) = raw @thumb then i get error

Unrecognized unit of measure: . Unrecognized unit of measure: . Unrecognized unit of measure: . Unrecognized unit of measure: .

Haw can i paste image from URI fo example? Help please!

webdev-rc commented 6 years ago

I answer myself! I remove from action 'create_docx'

  respond_to do |format|
    format.docx do
...

In routes I set route get "create_docx" => "fips_tzs#create_docx", format: 'docx' And I set mime Mime::Type.register "application/vnd.openxmlformats-officedocument.wordprocessingml.document", :docx Then I get doc from URI 'http://fips.glafir.ru/fips_tzs/:ID/create_docx' Its work fine!

gem 'rails', '5.0.2'

ZephiroRB commented 6 years ago

Please send full code. Does Not work, for me