gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 16:10:36 25 4
gpt4 key购买 nike

我正在关注 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)

关于ruby-on-rails - 如何在Prawn中设置表头?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5679118/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com