Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1417bbe8

Von Sven Schöling vor etwa 5 Jahren hinzugefügt

  • ID 1417bbe833f047497e2a5a3fab37db0eeaa73126
  • Vorgänger 23c33932
  • Nachfolger e03f83f2

ReportGenerator: Unterstützung für das Verbinden von Tabellenzellen mit dem "colspan"-Attribut in der PDF-Ausgabe.

Reimplementiert a18cc3f5dedae1c8b541b10df3b67153518663a6

Unterschiede anzeigen:

modules/override/PDF/Table.pm
374 374
    #=====================================
375 375
    # Disable header row into the table
376 376
    my $header_props = undef;
377
    my @header_rows;
377
    my (@header_rows, @header_row_cell_props);
378 378
    # Check if the user enabled it ?
379 379
    if(defined $arg{'header_props'} and ref( $arg{'header_props'}) eq 'HASH')
380 380
    {
......
434 434

  
435 435
    # Copy the header row if header is enabled
436 436
    if (defined $header_props) {
437
      map { push @header_rows, $$data[$_] } (0..$header_props->{num_header_rows} - 1);
437
      map { push @header_rows,           $$data[$_]       } (0..$header_props->{num_header_rows} - 1);
438
      map { push @header_row_cell_props, $$cell_props[$_] } (0..$header_props->{num_header_rows} - 1);
438 439
    }
439 440
    # Determine column widths based on content
440 441

  
......
446 447
    #  the actual widths of the column/row intersection
447 448
    my $row_col_widths = [];
448 449
    # An array ref with the widths of the header row
449
    my @header_row_props;
450
    my @header_row_widths;
450 451

  
451 452
    # Scalars that hold sum of the maximum and minimum widths of all columns
452 453
    my ( $max_col_w  , $min_col_w   ) = ( 0,0 );
......
458 459

  
459 460
    for( my $row_idx = 0; $row_idx < scalar(@$data) ; $row_idx++ )
460 461
    {
461
        push @header_row_props, [] if $row_idx < $header_props->{num_header_rows};
462
        push @header_row_widths, [] if $row_idx < $header_props->{num_header_rows};
462 463

  
463 464
        my $column_widths = []; #holds the width of each column
464 465
        # Init the height for this row
......
549 550

  
550 551
        # Copy the calculated row properties of header row.
551 552
        if (ref $header_props && $row_idx < $header_props->{num_header_rows}) {
552
          push @header_row_props, [ @{ $column_widths } ];
553
          push @header_row_widths, [ @{ $column_widths } ];
553 554
        }
554 555
    }
555 556

  
......
611 612
            {
612 613
                for my $idx (0 .. $header_props->{num_header_rows} - 1) {
613 614
                  unshift @$data,           [ @{ $header_rows[$idx]      } ];
614
                  unshift @$row_col_widths, [ @{ $header_row_props[$idx] } ];
615
                  unshift @$row_col_widths, [ @{ $header_row_widths[$idx] } ];
615 616
                  unshift @$rows_height,    $header_row_heights[$idx];
616 617
                }
617 618
                $remaining_header_rows = $header_props->{num_header_rows};
......
742 743

  
743 744
                my $this_width;
744 745
                if (!$remaining_header_rows && $cell_props->[$row_index][$column_idx]->{colspan}) {
745
                    $colspan     = -1 == $cell_props->[$row_index][$column_idx]->{colspan}
746
                                 ? $num_cols - $column_idx
747
                                 : $cell_props->[$row_index][$column_idx]->{colspan};
746
                    $colspan = $cell_props->[$row_index][$column_idx]->{colspan};
747
                } elsif ($remaining_header_rows && $header_row_cell_props[$header_props->{num_header_rows} - $remaining_header_rows][$column_idx]->{colspan}) {
748
                    $colspan = $header_row_cell_props[$header_props->{num_header_rows} - $remaining_header_rows][$column_idx]->{colspan};
749
                }
750

  
751
                if ($colspan) {
752
                    $colspan     = $num_cols - $column_idx if (-1 == $colspan);
748 753
                    my $last_idx = $column_idx + $colspan - 1;
749 754
                    $this_width  = sum @{ $calc_column_widths }[$column_idx..$last_idx];
750

  
751 755
                } else {
752 756
                    $this_width = $calc_column_widths->[$column_idx];
753 757
                }

Auch abrufbar als: Unified diff