Reverted Scrutinzer fix in Xslx Reader listWorksheetInfo (#1895)

This commit is contained in:
Patrick Brouwers 2021-03-03 21:34:45 +01:00 committed by GitHub
parent 3e672710cd
commit 000e6088c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 3 deletions

View File

@ -25,7 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
### Fixed ### Fixed
- Nothing. - Fixed issue with Xlsx@listWorksheetInfo not returning any data
## 1.17.1 - 2021-03-01 ## 1.17.1 - 2021-03-01
@ -697,4 +697,4 @@ For a comprehensive list of all class changes, and a semi-automated migration pa
## Previous versions of PHPExcel ## Previous versions of PHPExcel
The changelog for the project when it was called PHPExcel is [still available](./CHANGELOG.PHPExcel.md). The changelog for the project when it was called PHPExcel is [still available](./CHANGELOG.PHPExcel.md).

View File

@ -187,7 +187,8 @@ class Xlsx extends BaseReader
); );
if ($xmlWorkbook->sheets) { if ($xmlWorkbook->sheets) {
$dir = dirname($rel['Target']); $dir = dirname($rel['Target']);
foreach ($xmlWorkbook->sheets->sheet->children() as $eleSheet) { /** @var SimpleXMLElement $eleSheet */
foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
$tmpInfo = [ $tmpInfo = [
'worksheetName' => (string) $eleSheet['name'], 'worksheetName' => (string) $eleSheet['name'],
'lastColumnLetter' => 'A', 'lastColumnLetter' => 'A',

View File

@ -55,6 +55,25 @@ class XlsxTest extends TestCase
} }
} }
public function testListWorksheetInfo(): void
{
$filename = 'tests/data/Reader/XLSX/rowColumnAttributeTest.xlsx';
$reader = new Xlsx();
$actual = $reader->listWorksheetInfo($filename);
$expected = [
[
'worksheetName' => 'Sheet1',
'lastColumnLetter' => 'F',
'lastColumnIndex' => 5,
'totalRows' => '6',
'totalColumns' => 6,
],
];
self::assertEquals($expected, $actual);
}
public function testLoadXlsxRowColumnAttributes(): void public function testLoadXlsxRowColumnAttributes(): void
{ {
$filename = 'tests/data/Reader/XLSX/rowColumnAttributeTest.xlsx'; $filename = 'tests/data/Reader/XLSX/rowColumnAttributeTest.xlsx';