Skip to content

Instantly share code, notes, and snippets.

@rodrigovirgilio
Last active December 17, 2015 08:59
Show Gist options
  • Save rodrigovirgilio/5583987 to your computer and use it in GitHub Desktop.
Save rodrigovirgilio/5583987 to your computer and use it in GitHub Desktop.
Table with Prawn
def to_pdf
bounding_box([0, 770], :width => 520, :height => 40) do
stroke_bounds
text_box "18. Februar 2013 -", :at => [5, 35]
text_box "24. Februar 2013", :at => [5, 20]
end
move_down 2
header_1 = make_cell(:content => "18 Mo", width: 68)
header_2 = make_cell(:content => "19 Di", width: 68)
header_3 = make_cell(:content => "20 Mi", width: 68)
header_4 = make_cell(:content => "21 Do", width: 68)
header_5 = make_cell(:content => "22 Fr", width: 68)
header_6 = make_cell(:content => "23 Sa", width: 68)
header_7 = make_cell(:content => "24 So", width: 69)
table([ [{:content => " ", :rowspan => 2}, header_1, header_2, header_3, header_4, header_5, header_6, header_7],
[{:content => "", :colspan => 4}, " ", " ", " "],
["08:00", {:content => "", :colspan => 4}, " ", " ", " "],
["09:00", {:content => "", :colspan => 4}, " ", " ", " "],
["10:00", {:content => "", :colspan => 4}, " ", " ", " "],
["11:00", {:content => "", :colspan => 4}, " ", " ", " "],
["12:00", {:content => "", :colspan => 4}, " ", " ", " "],
["13:00", {:content => "", :colspan => 4}, " ", " ", " "],
["14:00", {:content => "", :colspan => 4}, " ", " ", " "],
["15:00", {:content => "", :colspan => 4}, " ", " ", " "],
["16:00", {:content => "", :colspan => 4}, " ", " ", " "],
["17:00", {:content => "", :colspan => 4}, " ", " ", " "],
["18:00", {:content => "", :colspan => 4}, " ", " ", " "],
[{:content => ""}, {:content => ""}, {:content => ""}, {:content => ""}, {:content => ""}, {:content => ""}, {:content => ""}, {:content => ""}],
["", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", ""]])
end
def teste
teste = Reports::Teste.new
render :text => teste.render, :content_type => "application/pdf; charset=ISO-8859-1"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment