1
我已经阅读了宝石的文档,但没有看到放置页眉或页脚。如何将页眉和页脚放在带有gem htmltoword的Rails中?
这是我的第一个代码:
format.docx {
render docx: "path_to/file.docx",
filename: "name_file-#{Time.now.strftime('%d-%m-%Y')}"
}
而且我“path_to/file.docx.haml”:
%html
%head
%body
%header
[..]
%content
%table[..]
%h1 [..]
%p [..]
%footer
%p
%ul
%li
[..]
而我的其他代码是:
format.docx {
render docx: "path_to/file.docx",
filename: "Proforma-#{Time.now.strftime('%d-%m-%Y')}",
header: {
:content => render_to_string({ template: 'path_to/header' })
},
footer: {
:content => render_to_string({ template: 'path_to/footer' })
}
}
和我的“path_to/file.docx.haml” o只有%content
标签。
然后,我有我的其他模板:“path_to/header.haml”,“path_to/footer.haml”。
但是没有人为我工作。 如何正确生成页眉和页脚?
什么宝石推荐我来产生一个词? – Dvex