简体   繁体   English

在导出到rails中的单词时,在所有页面中插入页脚

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

I am building a rails app. 我正在构建一个rails应用程序。 I use the gem " htmltoword " to export to Word document. 我使用gem“ htmltoword ”导出到Word文档。

The number of pages in the exported doc depends on the no:of records in the DB. 导出的doc中的页数取决于DB中的no:of records。 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 . 您链接到不再维护的htmltoword版本,请检查版本。 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. 您可以使用视图在操作中呈现文档(甚至可以通过直接自己实例化ActionView来执行操作),并且可以为所需的任何内容定义部分,并且如果每次都在页面上,则将页脚放入内部。

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. 对于特定于Word页脚,它可能会更复杂,但可能使用HTML table来显示您的数据并在开头使用tfoot ,gem将能够为您执行此操作。

Another solution if you're looking for print is to generate your document in another format, eg tex 如果您正在寻找打印,另一种解决方案是以另一种格式生成您的文档,例如tex

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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