The solution for that problem (nothing to do with PDF::API2, btw) would be to patch my patch :) i.e. pass $row_cnt instead of $rows_counter to the callback function (from within PDF::Table). The latter counts all displayed rows irrespective of whether they're headers, while the former counts data rows only.
And while you're at it, you might also want to pass $first_row, which indicates whether it's a header row — so you can then write
cell_render_hook => sub { my ($page, $row, $col, $is_first_row, $x, $y, $w, $h) = +@_; if (( $col == 0) && (!$is_first_row) ) { # ...instead of this (which doesn't work) # if (( $col == 0) && ($row >= 1) ) { my $t = $row-1; ...
For reference, the corresponding modified patch to PDF::Table would then look like this:
if (ref $arg{cell_render_hook} eq 'CODE') { $arg{cell_render_hook}->( $page, $row_cnt, $j, $first_row, $cur_x, $cur_y-$row_h, $calc_column_widths->[$j], $row_h ); }
In reply to Re: PDF::API2 Bug
by almut
in thread PDF::API2 Bug
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |