Fix for single row/column tables... though very weird to create manually in MS Excel, because creating a single row table always creates a two row table (1 row headers and 1 row data). But subsequently hiding the header row; and then deleting that row will create such a table.

This commit is contained in:
MarkBaker
2023-01-04 11:17:46 +01:00
parent 9366c3ea8f
commit 6f29e9ea49
3 changed files with 4 additions and 5 deletions
+2 -2
View File
@@ -298,8 +298,8 @@ class Table
}
[$width, $height] = Coordinate::rangeDimension($range);
if ($width < 1 || $height < 2) {
throw new PhpSpreadsheetException('The table range must be at least 1 column and 2 rows');
if ($width < 1 || $height < 1) {
throw new PhpSpreadsheetException('The table range must be at least 1 column and row');
}
$this->range = $range;
@@ -15,6 +15,6 @@ class Issue3277Test extends TestCase
$array = $spreadsheet->getActiveSheet()->toArray();
$this->assertSame('data', $array[0][0]);
self::assertSame('data', $array[0][0]);
}
}
@@ -207,9 +207,8 @@ class TableTest extends SetupTeardown
{
return [
['A1'],
['A1:A1'],
['B1:A4'],
['A1:D1'],
['B12:B4'],
['D1:A1'],
];
}