Revision 39414125
Von Sven Schöling vor fast 9 Jahren hinzugefügt
modules/override/PDF/Table.pm | ||
---|---|---|
370 | 370 |
#===================================== |
371 | 371 |
# Disable header row into the table |
372 | 372 |
my $header_props = undef; |
373 |
my @header_rows;
|
|
373 |
my (@header_rows, @header_row_cell_props);
|
|
374 | 374 |
# Check if the user enabled it ? |
375 | 375 |
if(defined $arg{'header_props'} and ref( $arg{'header_props'}) eq 'HASH') |
376 | 376 |
{ |
... | ... | |
428 | 428 |
|
429 | 429 |
# Copy the header row if header is enabled |
430 | 430 |
if (defined $header_props) { |
431 |
map { push @header_rows, $$data[$_] } (0..$header_props->{num_header_rows} - 1); |
|
431 |
map { push @header_rows, $$data[$_] } (0..$header_props->{num_header_rows} - 1); |
|
432 |
map { push @header_row_cell_props, $$cell_props[$_] } (0..$header_props->{num_header_rows} - 1); |
|
432 | 433 |
} |
433 | 434 |
# Determine column widths based on content |
434 | 435 |
|
... | ... | |
440 | 441 |
# the actual widths of the column/row intersection |
441 | 442 |
my $row_col_widths = []; |
442 | 443 |
# An array ref with the widths of the header row |
443 |
my @header_row_props;
|
|
444 |
my @header_row_widths;
|
|
444 | 445 |
|
445 | 446 |
# Scalars that hold sum of the maximum and minimum widths of all columns |
446 | 447 |
my ( $max_col_w , $min_col_w ) = ( 0,0 ); |
... | ... | |
451 | 452 |
|
452 | 453 |
for( my $row_idx = 0; $row_idx < scalar(@$data) ; $row_idx++ ) |
453 | 454 |
{ |
454 |
push @header_row_props, [] if $row_idx < $header_props->{num_header_rows};
|
|
455 |
push @header_row_widths, [] if $row_idx < $header_props->{num_header_rows};
|
|
455 | 456 |
|
456 | 457 |
my $column_widths = []; #holds the width of each column |
457 | 458 |
# Init the height for this row |
... | ... | |
535 | 536 |
|
536 | 537 |
# Copy the calculated row properties of header row. |
537 | 538 |
if (ref $header_props && $row_idx < $header_props->{num_header_rows}) { |
538 |
push @header_row_props, [ @{ $column_widths } ];
|
|
539 |
push @header_row_widths, [ @{ $column_widths } ];
|
|
539 | 540 |
} |
540 | 541 |
} |
541 | 542 |
|
... | ... | |
581 | 582 |
{ |
582 | 583 |
for my $idx (0 .. $header_props->{num_header_rows} - 1) { |
583 | 584 |
unshift @$data, [ @{ $header_rows[$idx] } ]; |
584 |
unshift @$row_col_widths, [ @{ $header_row_props[$idx] } ];
|
|
585 |
unshift @$row_col_widths, [ @{ $header_row_widths[$idx] } ];
|
|
585 | 586 |
unshift @$rows_height, $header_row_heights[$idx]; |
586 | 587 |
} |
587 | 588 |
$remaining_header_rows = $header_props->{num_header_rows}; |
... | ... | |
712 | 713 |
|
713 | 714 |
my $this_width; |
714 | 715 |
if (!$remaining_header_rows && $cell_props->[$row_index][$column_idx]->{colspan}) { |
715 |
$colspan = -1 == $cell_props->[$row_index][$column_idx]->{colspan} |
|
716 |
? $num_cols - $column_idx |
|
717 |
: $cell_props->[$row_index][$column_idx]->{colspan}; |
|
716 |
$colspan = $cell_props->[$row_index][$column_idx]->{colspan}; |
|
717 |
} elsif ($remaining_header_rows && $header_row_cell_props[$header_props->{num_header_rows} - $remaining_header_rows][$column_idx]->{colspan}) { |
|
718 |
$colspan = $header_row_cell_props[$header_props->{num_header_rows} - $remaining_header_rows][$column_idx]->{colspan}; |
|
719 |
} |
|
720 |
|
|
721 |
if ($colspan) { |
|
722 |
$colspan = $num_cols - $column_idx if (-1 == $colspan); |
|
718 | 723 |
my $last_idx = $column_idx + $colspan - 1; |
719 | 724 |
$this_width = sum @{ $calc_column_widths }[$column_idx..$last_idx]; |
720 |
|
|
721 | 725 |
} else { |
722 | 726 |
$this_width = $calc_column_widths->[$column_idx]; |
723 | 727 |
} |
Auch abrufbar als: Unified diff
ReportGenerator: Unterstützung für das Verbinden von Tabellenzellen mit dem "colspan"-Attribut in der PDF-Ausgabe.
Reimplementiert a18cc3f5dedae1c8b541b10df3b67153518663a6