Hi, Please run the below code, you would find that the cell formatting of the first row copies itself to the second row when the $col_props clearly defines it to be different. Why is this so and how can I fix it, please can someone tell me on priority.

use PDF::API2; use PDF::Table ; use Data::Dumper; my $sNewArray =[ ['25', '0.55', 'Yes', 'Yes', 'No'], ['30', '0.66', 'No', 'Yes', 'Yes'], ['50', '1.08','Yes', 'Yes', 'Yes'], ['60', '1.29', 'No', 'No', 'Yes'] ]; my $pdf = PDF::API2->new(); my $page = $pdf->page(); my $pdftable = new PDF::Table; my $cell_props; my $j = 0; foreach my $row ( @{$sNewArray} ) { my $k = 0; foreach my $cell ( @{$row} ) { if ( $cell eq 'Yes') { $cell_props->[$j]->[$k] ={ background_color => '#808080', font_color => '#808080', }; } elsif ( $cell eq 'No') { $cell_props->[$j]->[$k] ={ background_color => '#F5F5F5', font_color => '#F5F5F5', }; } else { $cell_props->[$j]->[$k] = { background_color => '#F5F5F5', font_color => 'black', }; } $k++; } $j++; } print Dumper $cell_props; $pdftable->table( # required params $pdf, $page, $sNewArray, x => 120, w => 325, start_y => 640, next_y => 640, start_h => 300, next_h => 300, border => 1.0, # some optional params padding => 5, padding_right => 10, font_size => 6, background_color_odd => '#E0E0E0', background_color_even => '#F0F0F0', column_props => [{ justify => 'center' }, { justify => 'center' }, { justify => 'center' }, { justify => 'center' }, { justify => 'center' } ], cell_props => $cell_props, ); $pdf->saveas('C://Perl//scripts//new2.pdf');

In reply to Urgent- Please help with cel_props for PDF::TABLE by gmohitg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.