Question

I'm building a site with Ruby on Rails 3.1 where I also need to have PDF versions of certain data. For this I use Prawn (master) with the Prawnto gem. Works really well. However, there is just this one thing that I cannot see how to get done.

The PDF contains tabular data where I would like to change the cell border styles differently to better visualize certain parts. At the moment I have rows that can be single or multiple grouped together. The single line or group should have a solid border around it to show that this is a group.

 -----------------------------------------------------------------
| Row 1                                                           |
 -----------------------------------------------------------------
 -----------------------------------------------------------------
| Row 1                                                           |
|                                                                 |
| Row 2                                                           |
 -----------------------------------------------------------------

Now what I'd like is to have a dashed/dotted line between row 1 and row 2 in the second group. I'd also need to in certain cases have vertical (left/right) dashed/dotted borders in cells.

 -----------------------------------------------------------------
| Row 1                                                           |
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
| Row 2                                                           |
 -----------------------------------------------------------------

I've been trawling the web for examples, but no luck at all. How can this be done? The only thing I can do is to dash all borders in the table, but this is not what I want.

pdf.dash 4, :space => 3
pdf.table data

I would like to be able to set the border styles individually for each cell, but also in a way where a cell can have different styles for different borders. I.e. top is solid and bottom is dashed.

Any suggestions or help how I can achieve this? Would a text box or bounding box help instead of using a table?

Thanks in advance!

Was it helpful?

Solution

No, this is not possible currently.

I have made a fork of prawn and added the necessary code that allows to mix solid, dashed and dotted cell borders in a table.

You can find the fork here.

Example usage when creating a table cell:

:border_lines => [:solid, :dotted, :dashed, :dashed]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top