Revision d11ebeaa
Von Sven Schöling vor mehr als 5 Jahren hinzugefügt
modules/override/PDF/Table.pm | ||
---|---|---|
939 | 939 |
$calc_widths->[$j] = $col_props->[$j]->{min_w} || 0;; |
940 | 940 |
} |
941 | 941 |
|
942 |
# Allow columns to expand to max_w before applying extra space equally. |
|
943 |
my $is_last_iter; |
|
944 |
for (;;) |
|
945 |
{ |
|
946 |
my $span = ($avail_width - $min_width) / scalar( @$col_props); |
|
947 |
last if $span <= 0; |
|
948 |
|
|
949 |
$min_width = 0; |
|
950 |
my $next_will_be_last_iter = 1; |
|
951 |
for(my $j = 0; $j < scalar(@$col_props); $j++ ) |
|
952 |
{ |
|
953 |
my $new_w = $calc_widths->[$j] + $span; |
|
954 |
|
|
955 |
if (!$is_last_iter && $new_w > $col_props->[$j]->{max_w}) |
|
956 |
{ |
|
957 |
$new_w = $col_props->[$j]->{max_w} |
|
958 |
} |
|
959 |
if ($calc_widths->[$j] != $new_w ) |
|
960 |
{ |
|
961 |
$calc_widths->[$j] = $new_w; |
|
962 |
$next_will_be_last_iter = 0; |
|
963 |
} |
|
964 |
$min_width += $new_w; |
|
965 |
} |
|
966 |
last if $is_last_iter; |
|
967 |
$is_last_iter = $next_will_be_last_iter; |
|
942 |
my $span = 0; |
|
943 |
# Calculate how much can be added to every column to fit the available width |
|
944 |
$span = ($avail_width - $min_width) / scalar( @$col_props); |
|
945 |
for (my $j = 0; $j < scalar(@$col_props); $j++ ) { |
|
946 |
$calc_widths->[$j] = $col_props->[$j]->{min_w} + $span; |
|
968 | 947 |
} |
969 | 948 |
|
970 | 949 |
return ($calc_widths,$avail_width); |
Auch abrufbar als: Unified diff
PDF::Table: Proportional skalieren statt adaptiv