Compare commits

..
4 Commits
Author SHA1 Message Date
Adrien Loison f7a682dbd6 Merge pull request #2 from box/bump_version_to_1_0_1
Bump version to 1.0.1
2015-01-26 15:38:15 -08:00
Adrien Loison 7301fc47fb Bump version to 1.0.1 2015-01-26 15:37:39 -08:00
Adrien Loison ce296f0662 Merge pull request #1 from box/add_support_empty_sheets
Add support for empty sheets
2015-01-26 11:28:26 -08:00
Adrien Loison 6bc9a18e9b Add support for empty sheets 2015-01-26 11:22:09 -08:00
4 changed files with 14 additions and 3 deletions

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
"name": "box/spout", "name": "box/spout",
"description": "PHP Library to read and write CSV and XLSX files, in a fast and scalable way", "description": "PHP Library to read and write CSV and XLSX files, in a fast and scalable way",
"type": "library", "type": "library",
"version": "1.0.0", "version": "1.0.1",
"keywords": ["php","read","write","csv","xlsx","excel","spreadsheet","scale","memory","stream","ooxml"], "keywords": ["php","read","write","csv","xlsx","excel","spreadsheet","scale","memory","stream","ooxml"],
"license": "Apache-2.0", "license": "Apache-2.0",
"homepage": "https://www.github.com/box/spout", "homepage": "https://www.github.com/box/spout",
+4 -2
View File
@@ -190,9 +190,11 @@ class XLSX extends AbstractReader
while ($this->xmlReader->read()) { while ($this->xmlReader->read()) {
if ($this->xmlReader->nodeType == \XMLReader::ELEMENT && $this->xmlReader->name === 'dimension') { if ($this->xmlReader->nodeType == \XMLReader::ELEMENT && $this->xmlReader->name === 'dimension') {
// Read dimensions of the worksheet // Read dimensions of the worksheet
$dimensionRef = $this->xmlReader->getAttribute('ref'); // returns 'A1:M13' for instance $dimensionRef = $this->xmlReader->getAttribute('ref'); // returns 'A1:M13' for instance (or 'A1' for empty sheet)
list(, $lastCellIndex) = explode(':', $dimensionRef); if (preg_match('/[A-Z\d]+:([A-Z\d]+)/', $dimensionRef, $matches)) {
$lastCellIndex = $matches[1];
$this->numberOfColumns = CellHelper::getColumnIndexFromCellIndex($lastCellIndex) + 1; $this->numberOfColumns = CellHelper::getColumnIndexFromCellIndex($lastCellIndex) + 1;
}
} else if ($this->xmlReader->nodeType == \XMLReader::ELEMENT && $this->xmlReader->name === 'row') { } else if ($this->xmlReader->nodeType == \XMLReader::ELEMENT && $this->xmlReader->name === 'row') {
// Start of the row description // Start of the row description
$isInsideRowTag = true; $isInsideRowTag = true;
+9
View File
@@ -165,6 +165,15 @@ class XLSXTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expectedFirstRow, $allRows[0], 'Entities should be ignored when reading XML files.'); $this->assertEquals($expectedFirstRow, $allRows[0], 'Entities should be ignored when reading XML files.');
} }
/**
* @return void
*/
public function testReadShouldBeAbleToProcessEmptySheets()
{
$allRows = $this->getAllRowsForFile('sheet_with_no_cells.xlsx');
$this->assertEquals([], $allRows, 'Sheet with no cells should be correctly processed.');
}
/** /**
* @param string $fileName * @param string $fileName
* @return array All the read rows the given file * @return array All the read rows the given file
Binary file not shown.