【问题标题】:Specify styling (font, in particular) for a certain cell in Prawn为 Prawn 中的某个单元格指定样式(特别是字体)
【发布时间】:2013-10-05 03:07:56
【问题描述】:

我想为某个单元格指定字体样式。我在文档中发现的是能够为所有单元执行此操作,但不是针对我需要的单元:

table data, :cell_style => { :font => "Times-Roman", :font_style => :italic }

如何只为一个单元格执行此操作?

【问题讨论】:

    标签: ruby-on-rails ruby pdf-generation prawn


    【解决方案1】:

    将您的表格变成一个块进行更多配置,然后您可以按行和列找​​到它。请参阅第 2 行的字体,我还提供了几个其他示例来按行和列设置样式:

    table(invoice_header_data, width: 210) do
      style(row(0).column(0), font: "Times-Roman")
      style(rows(0..-1), :padding => [2, 10, 2, 10], :borders => [])
      style(row(4), padding: [12, 10], :font_style => :bold)
      style(columns(1..3), :align => :right)
    end
    

    【讨论】:

      猜你喜欢
      • 2015-10-18
      • 2015-03-12
      • 2017-09-24
      • 1970-01-01
      • 2023-03-15
      • 1970-01-01
      • 2011-07-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多