加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 如何在Prawn中设置表头?

发布时间:2020-12-16 22:47:18 所属栏目:百科 来源:网络整理
导读:我正在关注 this tutorial使用prawn gem创建一个pdf文件, 我找到了生成表格的 this reference文档. 如何为每列设置标题行和标题标题? invoiceData = [["foo","bar"]]pdf.table(invoiceData) do |table|table.rows(1..3).width = 72end 解决方法 如果您通过
我正在关注 this tutorial使用prawn gem创建一个pdf文件,
我找到了生成表格的 this reference文档.

如何为每列设置标题行和标题标题?

invoiceData = [["foo","bar"]]
pdf.table(invoiceData) do |table|
table.rows(1..3).width = 72
end

解决方法

如果您通过:header =>如果选项为true,则应将数组的第一行用作重复标题.来自文档:
data = [["This row should be repeated on every new page"]]
data += [["..."]] * 30
table(data,:header => true)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读