Moodle PHP Documentation 4.1
Moodle 4.1.19+ (Build: 20250711) (5f47dc23ffc)
Box\Spout\Reader\XLSX\Manager\SheetManager Class Reference

Public Member Functions

 __construct ($filePath, $optionsManager, $sharedStringsManager, $escaper, $entityFactory)
 
 getSheets ()
 Returns the sheets metadata of the file located at the previously given file path.
 

Public Attributes

const SHEET_STATE_HIDDEN = 'hidden'
 State value to represent a hidden sheet.
 
const WORKBOOK_XML_FILE_PATH = 'xl/workbook.xml'
 
const WORKBOOK_XML_RELS_FILE_PATH = 'xl/_rels/workbook.xml.rels'
 Paths of XML files relative to the XLSX file root.
 
const XML_ATTRIBUTE_ACTIVE_TAB = 'activeTab'
 
const XML_ATTRIBUTE_DATE_1904 = 'date1904'
 Definition of XML attributes used to parse data.
 
const XML_ATTRIBUTE_ID = 'Id'
 
const XML_ATTRIBUTE_NAME = 'name'
 
const XML_ATTRIBUTE_R_ID = 'r:id'
 
const XML_ATTRIBUTE_STATE = 'state'
 
const XML_ATTRIBUTE_TARGET = 'Target'
 
const XML_NODE_RELATIONSHIP = 'Relationship'
 
const XML_NODE_SHEET = 'sheet'
 
const XML_NODE_SHEETS = 'sheets'
 
const XML_NODE_WORKBOOK_PROPERTIES = 'workbookPr'
 Definition of XML node names used to parse data.
 
const XML_NODE_WORKBOOK_VIEW = 'workbookView'
 

Protected Member Functions

 getSheetDataXMLFilePathForSheetId ($sheetId)
 
 getSheetFromSheetXMLNode ($xmlReaderOnSheetNode, $sheetIndexZeroBased, $isSheetActive)
 Returns an instance of a sheet, given the XML node describing the sheet - from "workbook.xml".
 
 processSheetsEndingNode ()
 
 processSheetStartingNode ($xmlReader)
 
 processWorkbookPropertiesStartingNode ($xmlReader)
 
 processWorkbookViewStartingNode ($xmlReader)
 

Protected Attributes

int $activeSheetIndex
 Index of the active sheet (0 by default)
 
int $currentSheetIndex
 Index of the sheet currently read.
 
InternalEntityFactory $entityFactory
 Factory to create entities.
 
Box Spout Common Helper Escaper XLSX $escaper
 Used to unescape XML data.
 
string $filePath
 Path of the XLSX file being read.
 
Box Spout Common Helper GlobalFunctionsHelper $globalFunctionsHelper
 Helper to work with global functions.
 
Box Spout Common Manager OptionsManagerInterface $optionsManager
 Reader's options manager.
 
Box Spout Reader XLSX Manager SharedStringsManager $sharedStringsManager
 Manages shared strings.
 
array $sheets
 List of sheets.
 

Constructor & Destructor Documentation

◆ __construct()

Box\Spout\Reader\XLSX\Manager\SheetManager::__construct ( $filePath,
$optionsManager,
$sharedStringsManager,
$escaper,
$entityFactory )
Parameters
string$filePathPath of the XLSX file being read
Box\Spout\Common\Manager\OptionsManagerInterface$optionsManagerReader's options manager
Box\Spout\Reader\XLSX\Manager\SharedStringsManager$sharedStringsManagerManages shared strings
Box\Spout\Common\Helper\Escaper\XLSX$escaperUsed to unescape XML data
InternalEntityFactory$entityFactoryFactory to create entities
mixed$sharedStringsManager

Member Function Documentation

◆ getSheetDataXMLFilePathForSheetId()

Box\Spout\Reader\XLSX\Manager\SheetManager::getSheetDataXMLFilePathForSheetId ( $sheetId)
protected
Parameters
string$sheetIdThe sheet ID, as defined in "workbook.xml"
Return values
stringThe XML file path describing the sheet inside "workbook.xml.res", for the given sheet ID

◆ getSheetFromSheetXMLNode()

Box\Spout\Reader\XLSX\Manager\SheetManager::getSheetFromSheetXMLNode ( $xmlReaderOnSheetNode,
$sheetIndexZeroBased,
$isSheetActive )
protected

Returns an instance of a sheet, given the XML node describing the sheet - from "workbook.xml".

We can find the XML file path describing the sheet inside "workbook.xml.res", by mapping with the sheet ID ("r:id" in "workbook.xml", "Id" in "workbook.xml.res").

Parameters
Box\Spout\Reader\Wrapper\XMLReader$xmlReaderOnSheetNodeXML Reader instance, pointing on the node describing the sheet, as defined in "workbook.xml"
int$sheetIndexZeroBasedIndex of the sheet, based on order of appearance in the workbook (zero-based)
bool$isSheetActiveWhether this sheet was defined as active
Return values
Box\Spout\Reader\XLSX\SheetSheet instance

◆ getSheets()

Box\Spout\Reader\XLSX\Manager\SheetManager::getSheets ( )

Returns the sheets metadata of the file located at the previously given file path.

The paths to the sheets' data are read from the [Content_Types].xml file.

Return values
Sheet[]Sheets within the XLSX file

◆ processSheetsEndingNode()

Box\Spout\Reader\XLSX\Manager\SheetManager::processSheetsEndingNode ( )
protected
Return values
intA return code that indicates what action should the processor take next

◆ processSheetStartingNode()

Box\Spout\Reader\XLSX\Manager\SheetManager::processSheetStartingNode ( $xmlReader)
protected
Parameters
Box\Spout\Reader\Wrapper\XMLReader$xmlReaderXMLReader object, positioned on a "<sheet>" starting node
Return values
intA return code that indicates what action should the processor take next

◆ processWorkbookPropertiesStartingNode()

Box\Spout\Reader\XLSX\Manager\SheetManager::processWorkbookPropertiesStartingNode ( $xmlReader)
protected
Parameters
Box\Spout\Reader\Wrapper\XMLReader$xmlReaderXMLReader object, positioned on a "<workbookPr>" starting node
Return values
intA return code that indicates what action should the processor take next

◆ processWorkbookViewStartingNode()

Box\Spout\Reader\XLSX\Manager\SheetManager::processWorkbookViewStartingNode ( $xmlReader)
protected
Parameters
Box\Spout\Reader\Wrapper\XMLReader$xmlReaderXMLReader object, positioned on a "<workbookView>" starting node
Return values
intA return code that indicates what action should the processor take next

The documentation for this class was generated from the following file: