|
| __construct ( $filePath, $tempFolder, $workbookRelationshipsManager, $entityFactory, $helperFactory, $cachingStrategyFactory) |
|
| cleanup () |
| Destroys the cache, freeing memory and removing any created artifacts.
|
|
| extractSharedStrings () |
| Builds an in-memory array containing all the shared strings of the sheet.
|
|
| getStringAtIndex ($sharedStringIndex) |
| Returns the shared string at the given index, using the previously chosen caching strategy.
|
|
| hasSharedStrings () |
| Returns whether the XLSX file contains a shared strings XML file.
|
|
|
const | XML_ATTRIBUTE_COUNT = 'count' |
| Definition of XML attributes used to parse data.
|
|
const | XML_ATTRIBUTE_UNIQUE_COUNT = 'uniqueCount' |
|
const | XML_ATTRIBUTE_VALUE_PRESERVE = 'preserve' |
|
const | XML_ATTRIBUTE_XML_SPACE = 'xml:space' |
|
const | XML_NODE_R = 'r' |
|
const | XML_NODE_SI = 'si' |
|
const | XML_NODE_SST = 'sst' |
| Definition of XML nodes names used to parse data.
|
|
const | XML_NODE_T = 't' |
|
|
CachingStrategyInterface | $cachingStrategy |
| The best caching strategy for storing shared strings.
|
|
CachingStrategyFactory | $cachingStrategyFactory |
| Factory to create shared strings caching strategies.
|
|
InternalEntityFactory | $entityFactory |
| Factory to create entities.
|
|
string | $filePath |
| Path of the XLSX file being read.
|
|
HelperFactory | $helperFactory |
| Factory to create helpers.
|
|
string | $tempFolder |
| Temporary folder where the temporary files to store shared strings will be stored.
|
|
WorkbookRelationshipsManager | $workbookRelationshipsManager |
| Helps retrieving workbook relationships.
|
|
◆ __construct()
Box\Spout\Reader\XLSX\Manager\SharedStringsManager::__construct |
( |
| $filePath, |
|
|
| $tempFolder, |
|
|
| $workbookRelationshipsManager, |
|
|
| $entityFactory, |
|
|
| $helperFactory, |
|
|
| $cachingStrategyFactory ) |
- Parameters
-
string | $filePath | Path of the XLSX file being read |
string | $tempFolder | Temporary folder where the temporary files to store shared strings will be stored |
WorkbookRelationshipsManager | $workbookRelationshipsManager | Helps retrieving workbook relationships |
InternalEntityFactory | $entityFactory | Factory to create entities |
HelperFactory | $helperFactory | Factory to create helpers |
CachingStrategyFactory | $cachingStrategyFactory | Factory to create shared strings caching strategies |
◆ cleanup()
Box\Spout\Reader\XLSX\Manager\SharedStringsManager::cleanup |
( |
| ) |
|
Destroys the cache, freeing memory and removing any created artifacts.
- Return values
-
◆ extractSharedStrings()
Box\Spout\Reader\XLSX\Manager\SharedStringsManager::extractSharedStrings |
( |
| ) |
|
Builds an in-memory array containing all the shared strings of the sheet.
All the strings are stored in a XML file, located at 'xl/sharedStrings.xml'. It is then accessed by the sheet data, via the string index in the built table.
More documentation available here: http://msdn.microsoft.com/en-us/library/office/gg278314.aspx
The XML file can be really big with sheets containing a lot of data. That is why we need to use a XML reader that provides streaming like the XMLReader library.
- Exceptions
-
- Return values
-
◆ getBestSharedStringsCachingStrategy()
Box\Spout\Reader\XLSX\Manager\SharedStringsManager::getBestSharedStringsCachingStrategy |
( |
| $sharedStringsUniqueCount | ) |
|
|
protected |
Returns the best shared strings caching strategy.
- Parameters
-
int | null | $sharedStringsUniqueCount | Number of unique shared strings (NULL if unknown) |
- Return values
-
◆ getSharedStringsUniqueCount()
Box\Spout\Reader\XLSX\Manager\SharedStringsManager::getSharedStringsUniqueCount |
( |
| $xmlReader | ) |
|
|
protected |
Returns the shared strings unique count, as specified in <sst> tag.
- Parameters
-
- Exceptions
-
- Return values
-
int|null | Number of unique shared strings in the sharedStrings.xml file |
◆ getStringAtIndex()
Box\Spout\Reader\XLSX\Manager\SharedStringsManager::getStringAtIndex |
( |
| $sharedStringIndex | ) |
|
Returns the shared string at the given index, using the previously chosen caching strategy.
- Parameters
-
int | $sharedStringIndex | Index of the shared string in the sharedStrings.xml file |
- Exceptions
-
- Return values
-
string | The shared string at the given index |
◆ hasSharedStrings()
Box\Spout\Reader\XLSX\Manager\SharedStringsManager::hasSharedStrings |
( |
| ) |
|
Returns whether the XLSX file contains a shared strings XML file.
- Return values
-
◆ processSharedStringsItem()
Box\Spout\Reader\XLSX\Manager\SharedStringsManager::processSharedStringsItem |
( |
| $xmlReader, |
|
|
| $sharedStringIndex ) |
|
protected |
Processes the shared strings item XML node which the given XML reader is positioned on.
- Parameters
-
- Return values
-
◆ shouldExtractTextNodeValue()
Box\Spout\Reader\XLSX\Manager\SharedStringsManager::shouldExtractTextNodeValue |
( |
| $textNode | ) |
|
|
protected |
Not all text nodes' values must be extracted.
Some text nodes are part of a node describing the pronunciation for instance. We'll only consider the nodes whose parents are "<si>" or "<r>".
- Parameters
-
DOMElement | $textNode | Text node to check |
- Return values
-
bool | Whether the given text node's value must be extracted |
◆ shouldPreserveWhitespace()
Box\Spout\Reader\XLSX\Manager\SharedStringsManager::shouldPreserveWhitespace |
( |
| $textNode | ) |
|
|
protected |
If the text node has the attribute 'xml:space="preserve"', then preserve whitespace.
- Parameters
-
DOMElement | $textNode | The text node element (<t>) whose whitespace may be preserved |
- Return values
-
bool | Whether whitespace should be preserved |
The documentation for this class was generated from the following file:
- lib/spout/src/Spout/Reader/XLSX/Manager/SharedStringsManager.php