Table: Header true bug #413

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

Projects

None yet

3 participants

@ottost

The option :header => true pdf.table(data, row_colors: ['DDDDDD','EFEFEF'], header: true)
Show an unwanted line from the second page until the last page, pay attention to the row "i5"

image:
http://cl.ly/image/2G1b2E0r0d0i

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'}
            ]

costo_total = 0;
beneficio_total = 0;
@cards.each_with_index do |card, i|
costo_total = costo_total + card.cost
beneficio_total = beneficio_total + card.benefit
cell = [
{content: "i#{i+1}", size: 8},
{content: "#{card.description}:\n\n#{card.goal_description}", size: 8},
{content: "#{card.expected_results}\n\n#{card.processes_impacted}", size: 8},

                "#{card.extent_strategy ? 'x':''}",
                "#{card.extent_structure ? 'x':''}",
                "#{card.extent_processes ? 'x':''}",
                "#{card.extent_tools ? 'x':''}",

                "#{card.strategy_antenna ? 'x':''}",
                "#{card.strategy_document_management ? 'x':''}",
                "#{card.strategy_collaboration ? 'x':''}",
                "#{card.strategy_experts_management ? 'x':''}",
                "#{card.strategy_communication ? 'x':''}",
                "#{card.strategy_personal_learning ? 'x':''}",
                "#{card.strategy_organizational_learning ? 'x':''}",
                "#{card.strategy_innovation_improvements ? 'x':''}",

                "#{card.focus_connect ? 'x':''}",
                "#{card.focus_socialize ? 'x':''}",
                "#{card.focus_arrange ? 'x':''}",
                "#{card.focus_develop ? 'x':''}",

                {content: "#{card.cost}", align: :right},
                {content: "#{card.benefit}", align: :right}
                ]
data << cell

end

data << [{content: "Total", colspan:19, background_color: 'CCCCCC'}, {content: "#{costo_total}", align: :right}, {content: "#{beneficio_total}", align: :right, background_color: 'CCCCCC'}]

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

@jonsgreen
prawnpdf member

I am having trouble seeing the problem from your image and it is difficult to run your code as is.

Are you able to create a better image with more description of where the unwanted line is and ideally post some simpler code that could be run without being dependent on external data?

@bradediger
prawnpdf member

Hi @ottost,
I think that the changes in #452 and #459 may have fixed your issue. If you still have problems with the latest master branch, let us know and we'll reopen and investigate further.

-be

@bradediger bradediger closed this Mar 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment