karnov / htmltoword

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

respond_with not taking arguments? #25

Open illbedan opened 9 years ago

illbedan commented 9 years ago

I'm having trouble getting all the pieces working. I have a template in /lib/htmltoword/templates/mytemplate.ott I installed the gem, put it in the gem file, bundle install at the top of my controller: respond_to :docx

in my controller function I've tried a zillion things at this point. but it seems respond_with doesn't accept arguments at all

respond_with(@project, filename: 'meh.docx', word_template: 'mytemplate.ott')

gives me a file based off of @project and the function_name.docx.erb file in the views, but the file name is 'function_name.docx', and no sign of the template at all. completely equivalent response when I replace the line with

respond_with(@project)

I tried replacing with:

render docx: 'function_name', filename: 'foo.docx', word_template: 'mytemplate.ott'

and I get the file name right, still no sign of the template, and the bgcolor tags I have in the .docx.erb file no longer show up. in addition, the font size changed from 12 to 9, but the template sets them to 10, so it's still not getting the right template, though it is getting a different one(or maybe just a more default default).

When I look at it, it says user error to me, but I'm really stuck >_< I appreciate any direction you could give me.

Thanks

brewdium commented 8 years ago

Maybe try dropping back to 0.4.4, i had some success with that