2016-09-19 33 views
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”

但是没有人为我工作。 如何正确生成页眉和页脚?

回答

0

此宝石目前不支持此功能(无论页眉或页脚)。看到这个线程here

+0

什么宝石推荐我来产生一个词? – Dvex