Better date support
Although Excel has a Date type, older Excel versions use numeric values to store dates. The value represents the number of days since Jan 1st, 1900. The only way to tell if the value is a number or a date is to look at the styles.xml and check if the cell has date formatting.
This commit is contained in:
1 parent
46c246e6a4
commit
8ef6bdac62
8 files changed
+485
-7
No files matched your search
@@ -8,6 +8,7 @@ use Box\Spout\Reader\IteratorInterface;
|
||||
use Box\Spout\Reader\Wrapper\XMLReader;
|
||||
use Box\Spout\Reader\XLSX\Helper\CellHelper;
|
||||
use Box\Spout\Reader\XLSX\Helper\CellValueFormatter;
|
||||
use Box\Spout\Reader\XLSX\Helper\StyleHelper;
|
||||
|
||||
/**
|
||||
* Class RowIterator
|
||||
@@ -39,6 +40,9 @@ class RowIterator implements IteratorInterface
|
||||
/** @var Helper\CellValueFormatter Helper to format cell values */
|
||||
protected $cellValueFormatter;
|
||||
|
||||
/** @var Helper\StyleHelper $styleHelper Helper to work with styles */
|
||||
protected $styleHelper;
|
||||
|
||||
/** @var int Number of read rows */
|
||||
protected $numReadRows = 0;
|
||||
|
||||
@@ -62,7 +66,9 @@ class RowIterator implements IteratorInterface
|
||||
$this->sheetDataXMLFilePath = $this->normalizeSheetDataXMLFilePath($sheetDataXMLFilePath);
|
||||
|
||||
$this->xmlReader = new XMLReader();
|
||||
$this->cellValueFormatter = new CellValueFormatter($sharedStringsHelper);
|
||||
|
||||
$this->styleHelper = new StyleHelper($filePath);
|
||||
$this->cellValueFormatter = new CellValueFormatter($sharedStringsHelper, $this->styleHelper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user