- $colspan = -1 == $cell_props->[$row_index][$column_idx]->{colspan}
- ? $num_cols - $column_idx
- : $cell_props->[$row_index][$column_idx]->{colspan};
+ $colspan = $cell_props->[$row_index][$column_idx]->{colspan};
+ } elsif ($remaining_header_rows && $header_row_cell_props[$header_props->{num_header_rows} - $remaining_header_rows][$column_idx]->{colspan}) {
+ $colspan = $header_row_cell_props[$header_props->{num_header_rows} - $remaining_header_rows][$column_idx]->{colspan};
+ }
+
+ if ($colspan) {
+ $colspan = $num_cols - $column_idx if (-1 == $colspan);