Expose a Sheet object on Reader::XLSX::nextSheet()
Added Sheet class for the XLSX reader that exposes basic sheet info, such as name or ID. When retrieving the sheet data XML, added extra XML parsing to retrieve sheet data. Added test
This commit is contained in:
1 parent
e58284d27b
commit
e9ec4e745c
7 files changed
+279
-33
No files matched your search
@@ -10,18 +10,23 @@ namespace Box\Spout\Reader\Internal\XLSX;
|
||||
*/
|
||||
class Worksheet
|
||||
{
|
||||
/** @var \Box\Spout\Reader\Sheet The "external" sheet */
|
||||
protected $externalSheet;
|
||||
|
||||
/** @var int Worksheet number, based on the order of appareance in [Content_Types].xml (zero-based) */
|
||||
protected $worksheetNumber;
|
||||
|
||||
/** @var string Path of the XML file containing the worksheet data */
|
||||
protected $dataXmlFilePath;
|
||||
|
||||
/**
|
||||
/**\
|
||||
* @param \Box\Spout\Reader\Sheet $externalSheet The associated "external" sheet
|
||||
* @param int $worksheetNumber Worksheet number, based on the order of appareance in [Content_Types].xml (zero-based)
|
||||
* @param string $dataXmlFilePath Path of the XML file containing the worksheet data
|
||||
*/
|
||||
public function __construct($worksheetNumber, $dataXmlFilePath)
|
||||
public function __construct($externalSheet, $worksheetNumber, $dataXmlFilePath)
|
||||
{
|
||||
$this->externalSheet = $externalSheet;
|
||||
$this->worksheetNumber = $worksheetNumber;
|
||||
$this->dataXmlFilePath = $dataXmlFilePath;
|
||||
}
|
||||
@@ -34,6 +39,14 @@ class Worksheet
|
||||
return ltrim($this->dataXmlFilePath, '/');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Box\Spout\Reader\Sheet The "external" sheet
|
||||
*/
|
||||
public function getExternalSheet()
|
||||
{
|
||||
return $this->externalSheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user