Skip to content

Commit 0b61140

Browse files
committed
ITST-19066: [xlsx-reader] Add support for multi-range row span values
- Always use the last segment of the spans element.
1 parent 0794764 commit 0b61140

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Reader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,13 @@ public function next()
279279

280280
$this->row_open = true;
281281

282-
/* Getting the row spanning area (stored as e.g., 1:12)
282+
/* Getting the row spanning area (stored as e.g. "1:12", or more rarely, "1:3 6:8 11:12")
283283
* so that the last cells will be present, even if empty. */
284284
$row_spans = $this->worksheet_reader->getAttributeNsId('spans');
285285

286286
if ($row_spans) {
287287
$row_spans = explode(':', $row_spans);
288-
$current_row_column_count = $row_spans[1];
288+
$current_row_column_count = array_pop($row_spans); // Always get the last segment, regardless of spans structure.
289289
} else {
290290
$current_row_column_count = 0;
291291
}
@@ -313,7 +313,7 @@ public function next()
313313
$row_spans = $this->worksheet_reader->getAttributeNsId('spans');
314314
if ($row_spans) {
315315
$row_spans = explode(':', $row_spans);
316-
$current_row_column_count = $row_spans[1];
316+
$current_row_column_count = array_pop($row_spans); // Always get the last segment, regardless of spans structure.
317317
} else {
318318
$current_row_column_count = 0;
319319
}

0 commit comments

Comments
 (0)