简体   繁体   中英

Insert a footer in all pages while exporting to word from rails

I am building a rails app. I use the gem " htmltoword " to export to Word document.

The number of pages in the exported doc depends on the no:of records in the DB. I want a content in footer in all the pages of the exported document.

Is there any way to do this?

You linked to a no longer maintained version of htmltoword, check this one . You can use views to render your document in an action (or even without an action by instanciating an ActionView directly yourself), and you can define partials for anything you want, and put a footer inside if it takes on page each time.

For Word specific footer it could a bit more complicated, but maybe using a HTML table to display your data and use a tfoot at the beginning the gem will be able to do that for you.

Another solution if you're looking for print is to generate your document in another format, eg tex

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM