如何使用docx_report gem在docx文件中添加表格?

时间:2019-06-04 22:06:11

标签: ruby-on-rails ruby templates docx

我正在尝试使用docx_report gem将Word文件中的表格作为模板填充,但是我对此感到困惑(或者如果您还有其他gem可以解决我的意图,请告诉我):

require 'docx_report'

file_template = 'test_template.docx'
file_output = 'output.docx'

report = DocxReport.create_docx_report(file_template)

@users = {"name" => "some name"} # A simple hash to test     

report.add_table 'table1', @users do |table|
  table.add_field(:title, :name)
end

report.generate_docx file_output

这是gem网站https://github.com/abudaqqa/docx_report,但我不明白。

0 个答案:

没有答案