Option to keep empty rows (#331)

* Add option to preserve empty rows when reading an XLSX file
* Add option to preserve empty rows when reading a CSV file
* Add option to preserve empty rows when reading an ODS file
This commit is contained in:
Adrien Loison authored and GitHub committed 2016-10-17 10:20:02 -07:00
1 parent 77178122c3
commit 0978d340f0
24 files changed
+612 -209

No files matched your search

+17
View File
@@ -22,6 +22,9 @@ abstract class AbstractReader implements ReaderInterface
/** @var bool Whether date/time values should be returned as PHP objects or be formatted as strings */
protected $shouldFormatDates = false;
/** @var bool Whether empty rows should be returned or skipped */
protected $shouldPreserveEmptyRows = false;
/**
* Returns whether stream wrappers are supported
*
@@ -64,6 +67,7 @@ abstract class AbstractReader implements ReaderInterface
/**
* Sets whether date/time values should be returned as PHP objects or be formatted as strings.
*
* @api
* @param bool $shouldFormatDates
* @return AbstractReader
*/
@@ -73,6 +77,19 @@ abstract class AbstractReader implements ReaderInterface
return $this;
}
/**
* Sets whether empty rows should be returned or skipped.
*
* @api
* @param bool $shouldPreserveEmptyRows
* @return AbstractReader
*/
public function setShouldPreserveEmptyRows($shouldPreserveEmptyRows)
{
$this->shouldPreserveEmptyRows = $shouldPreserveEmptyRows;
return $this;
}
/**
* Prepares the reader to read the given file. It also makes sure
* that the file exists and is readable.