Revision a18cc3f5
Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt
modules/override/PDF/Table.pm | ||
---|---|---|
240 | 240 |
# Disable header row into the table |
241 | 241 |
my $header_props; |
242 | 242 |
my $num_header_rows = 0; |
243 |
my @header_rows;
|
|
243 |
my (@header_rows, @header_row_cell_props);
|
|
244 | 244 |
# Check if the user enabled it ? |
245 | 245 |
if (defined $arg{'header_props'} and ref( $arg{'header_props'}) eq 'HASH') { |
246 | 246 |
# Transfer the reference to local variable |
... | ... | |
285 | 285 |
if (ref $data eq 'ARRAY') { |
286 | 286 |
# Copy the header row if header is enabled |
287 | 287 |
if (defined $header_props) { |
288 |
map { push @header_rows, $$data[$_] } (0..$num_header_rows - 1); |
|
288 |
map { push @header_rows, $$data[$_] } (0..$num_header_rows - 1); |
|
289 |
map { push @header_row_cell_props, $$cell_props[$_] } (0..$num_header_rows - 1); |
|
289 | 290 |
} |
290 | 291 |
# Determine column widths based on content |
291 | 292 |
|
... | ... | |
297 | 298 |
# the actual widths of the column/row intersection |
298 | 299 |
my $row_props = []; |
299 | 300 |
# An array ref with the widths of the header row |
300 |
my @header_row_props;
|
|
301 |
my @header_row_widths;
|
|
301 | 302 |
|
302 | 303 |
# Scalars that hold sum of the maximum and minimum widths of all columns |
303 | 304 |
my ( $max_col_w, $min_col_w ) = ( 0,0 ); |
... | ... | |
308 | 309 |
my $rows_counter = 0; |
309 | 310 |
|
310 | 311 |
foreach $row ( @{$data} ) { |
311 |
push(@header_row_props, []) if ($rows_counter < $num_header_rows);
|
|
312 |
push(@header_row_widths, []) if ($rows_counter < $num_header_rows);
|
|
312 | 313 |
|
313 | 314 |
my $column_widths = []; #holds the width of each column |
314 | 315 |
for( my $j = 0; $j < scalar(@$row) ; $j++ ) { |
... | ... | |
367 | 368 |
$row_props->[$rows_counter] = $column_widths; |
368 | 369 |
# Copy the calculated row properties of header row. |
369 | 370 |
if (($rows_counter < $num_header_rows) && $header_props) { |
370 |
push(@header_row_props, [ @{ $column_widths } ]);
|
|
371 |
push(@header_row_widths, [ @{ $column_widths } ]);
|
|
371 | 372 |
} |
372 | 373 |
$rows_counter++; |
373 | 374 |
} |
374 |
$main::lxdebug->dump(0, "hrp", \@header_row_props); |
|
375 | 375 |
# Calc real column widths and expand table width if needed. |
376 | 376 |
my $calc_column_widths; |
377 | 377 |
($calc_column_widths, $width) = $self->CalcColumnWidths( $col_props, $width ); |
... | ... | |
405 | 405 |
if ( ref $header_props and $header_props->{'repeat'}) { |
406 | 406 |
foreach my $idx (0 .. $num_header_rows - 1) { |
407 | 407 |
unshift @$data, [ @{ $header_rows[$idx] } ]; |
408 |
unshift @$row_props, [ @{ $header_row_props[$idx] } ];
|
|
408 |
unshift @$row_props, [ @{ $header_row_widths[$idx] } ];
|
|
409 | 409 |
} |
410 | 410 |
$remaining_header_rows = $num_header_rows; |
411 | 411 |
} |
... | ... | |
502 | 502 |
|
503 | 503 |
my $this_width; |
504 | 504 |
if (!$remaining_header_rows && $cell_props->[$row_cnt]->[$j]->{colspan}) { |
505 |
$colspan = -1 == $cell_props->[$row_cnt]->[$j]->{colspan} ? $num_cols - $j : $cell_props->[$row_cnt]->[$j]->{colspan}; |
|
505 |
$colspan = $cell_props->[$row_cnt]->[$j]->{colspan}; |
|
506 |
|
|
507 |
} elsif ($remaining_header_rows && $header_row_cell_props[$num_header_rows - $remaining_header_rows]->[$j]->{colspan}) { |
|
508 |
$colspan = $header_row_cell_props[$num_header_rows - $remaining_header_rows]->[$j]->{colspan}; |
|
509 |
|
|
510 |
} |
|
511 |
|
|
512 |
if ($colspan) { |
|
513 |
$colspan = $num_cols - $j if (-1 == $colspan); |
|
506 | 514 |
my $last_idx = $j + $colspan - 1; |
507 | 515 |
$this_width = sum @{ $calc_column_widths }[$j..$last_idx]; |
508 | 516 |
|
Auch abrufbar als: Unified diff
ReportGenerator: Unterstützung für das Verbinden von Tabellenzellen mit dem "colspan"-Attribut in der PDF-Ausgabe.