Table error fill color #412

Closed
ottost opened this Issue Oct 10, 2012 · 2 comments

Comments

Projects
None yet
3 participants

ottost commented Oct 10, 2012

The columns with rowspan and colspan fill only the first cell of merged cells.

Image (Pay attention to the first row).
http://cl.ly/image/2N1f1U1F0a0l

Code:

data = Array.new
data << [
{colspan: 3, content: 'Iniciativa', align: :center, background_color: 'AAAAAA'},
{colspan: 4, content: 'Alcance', align: :center, background_color: 'AAAAAA'},
{colspan: 8, content: 'Estrategia', align: :center, background_color: 'AAAAAA'},
{colspan: 4, content: 'Enfoque', align: :center, background_color: 'AAAAAA'},
{colspan: 2, content: 'Valoración', align: :center, size: 10, background_color: 'AAAAAA'}
]
data << [
{content: '#', height: 150, align: :center, background_color: 'CCCCCC'},
{content: "Descripción y\nObjetivos", align: :center, background_color: 'CCCCCC'},
{content: "Resultados y\nProcesos", align: :center, background_color: 'CCCCCC'},

            {content: 'E s t  r a t e g i a', overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},
            {content: 'E s t  r u c t u r a s', overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},
            {content: 'P r o c e s o s', overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},
            {content: 'H e r r a m i e n t a s', overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},

            {content: 'A n t e n a', overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},
            {content: "G e s t. \n\nD o c.", overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},
            {content: 'C o l a b o r a c i ó n', overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},
            {content: "G e s t.\n\nE x p e r t.", overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},
            {content: 'C o m u n i c a c i ó n', overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},
            {content: "A p r e n d.\n\nP e r s o.", overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},
            {content: "A p r e n d.\n\nO r g a n.", overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},
            {content: "I n n o v.\n/\nM e j o r a s", overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},

            {content: 'C o n e c t a r', overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},
            {content: 'O r d e n a r', overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},
            {content: 'S o c i a l  i z a r', overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},
            {content: 'D e s a r r o l  l a r', overflow: :trunc, width: 18, size: 10, valign: :top, align: :center, background_color: 'CCCCCC'},

            {content: 'Costo', width: 30, align: :center, size: 8, background_color: 'CCCCCC'},
            {content: 'Benef.', width: 30, align: :center, size: 8, background_color: 'CCCCCC'}
            ]

......
pdf.table(data, row_colors: ['DDDDDD','EFEFEF'])

Member

jonsgreen commented Oct 27, 2012

I took a quick look at this bug and found that a possible simple fix is to have the dummy cell delegate background_color to its master_cell.

extend Forwardable
def_delegator :@master_cell, :background_color

This doesn't break any specs and I am not sure if this is worthy of a new spec.

I don't know who is the guru on tables these days but it would be great if someone more familiar with this part of the code weighed in on this.

@bradediger bradediger closed this in bee7cd9 Mar 8, 2013

Member

bradediger commented Mar 8, 2013

Thanks @jordanbyron. I ended up just writing this as a single method call because I think using def_delegator is a bit heavy-handed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment