Module: PdfTableHelper
- Defined in:
- app/pdfs/concerns/pdf_table_helper.rb
Constant Summary collapse
- NORMAL_TH =
{ align: :center, valign: :center, size: 14, font_style: :bold, height: 30, background_color: 'eeeeee' }
- NORMAL_TD =
{ align: :left, valign: :center, size: 12, height: 30 }
- LEFT_TD =
{ align: :left, valign: :center, size: 12 }
- RIGHT_TD =
{ align: :right, valign: :center, size: 12 }
Instance Method Summary collapse
- #content_table(data, options = {}, &block) ⇒ Object
- #footer_table(data) ⇒ Object
- #grid_table(data, options = {}) ⇒ Object
- #left_header_table(data) ⇒ Object
- #top_header_table(data) ⇒ Object
Instance Method Details
#content_table(data, options = {}, &block) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'app/pdfs/concerns/pdf_table_helper.rb', line 73 def content_table(data, = {}, &block) = { position: :center, width: bounds.width, cell_style: { border_lines: [:solid, :solid, :solid, :solid], border_color: '999999' } } .merge!() undash if block_given? table(data, , &block) else table(data, ) do row(0..-1).style NORMAL_TD end end end |
#footer_table(data) ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'app/pdfs/concerns/pdf_table_helper.rb', line 93 def (data) = { position: :center, width: bounds.width, cell_style: { borders: [] } } undash table(data, ) do columns(0..-1).style NORMAL_TD end end |
#grid_table(data, options = {}) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/pdfs/concerns/pdf_table_helper.rb', line 57 def grid_table(data, = {}) = { position: :center, width: bounds.width, cell_style: { borders: [] } } .merge!() undash table(data, ) do columns(0).style LEFT_TD columns(-1).style RIGHT_TD end end |
#left_header_table(data) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/pdfs/concerns/pdf_table_helper.rb', line 27 def left_header_table(data) = { position: :center, width: bounds.width, cell_style: { border_lines: [:solid, :solid, :dashed, :solid] } } undash table(data, ) do columns(0).style NORMAL_TH columns(1..-1).style NORMAL_TD end end |
#top_header_table(data) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/pdfs/concerns/pdf_table_helper.rb', line 42 def top_header_table(data) = { position: :center, width: bounds.width, cell_style: { border_lines: [:solid, :solid, :dashed, :solid] } } undash table(data, ) do row(0).style NORMAL_TH row(1..-1).style NORMAL_TD end end |