Вопрос

I have the following table:

link

And I need to recreate this table using ruby and the Prawn gem. I am having a hard time getting the "Time In" and "Time Out" cells to be broken up like they are. I have tried creating subtables within my table, but the code is extremely ugly and it's almost a guessing game trying to figure out the correct cell widths.

Note the first and last columns in row 1. They are a single cell, but the other "day" columns all contain several cells.

Can someone give me some tips on how to recreate the table in the image above using Prawn?

EDIT:

Also, it's worth noting that:

table(table_data, :width => 500, :cell_style => { :inline_format => true })

does not work if you have a table within a table. I need to be able to use :inline_format, but that throws an error if table_data contains a subtable within a table.

Это было полезно?

Решение

What about something like this?

table([
            [{content: "First Name", borders: [:left, :top]}, {:content => "Monday", :colspan => 2},{:content => "Tuesday and so on", :colspan => 2}, {content: 'Signatures...', rowspan: 3}],
            [{content: '', borders: [:left]},'Time In', 'Time Out', 'Time In', 'Time Out'],
            [{content: '(as it appears<br/> on PBF)', borders: [:left, :bottom], align: :right, inline_format: true }, 'Initials', 'Initials', 'Initials', 'Initials']
          ])
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top