【发布时间】:2017-01-26 16:55:12
【问题描述】:
我已阅读 gem 的文档,但没有看到放置页眉或页脚。
这是我的第一个代码:
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"只有%content标签。
然后我有其他模板:"path_to/header.haml"、"path_to/footer.haml"。
但是没有一个对我有用。 如何正确生成带有页眉和页脚的单词?
【问题讨论】:
标签: html ruby-on-rails ruby ms-word