[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/spout/src/Spout/Reader/XLSX/Helper/ -> SharedStringsHelper.php (summary)

(no description)

File Size: 248 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

SharedStringsHelper:: (11 methods):
  __construct()
  hasSharedStrings()
  extractSharedStrings()
  getSharedStringsFilePath()
  getSharedStringsUniqueCount()
  getBestSharedStringsCachingStrategy()
  getSimpleXmlElementNodeFromXMLReader()
  removeSuperfluousTextNodes()
  shouldPreserveWhitespace()
  getStringAtIndex()
  cleanup()


Class: SharedStringsHelper  - X-Ref

Class SharedStringsHelper
This class provides helper functions for reading sharedStrings XML file

__construct($filePath, $tempFolder = null)   X-Ref

param: string $filePath Path of the XLSX file being read
param: string|void $tempFolder Temporary folder where the temporary files to store shared strings will be stored

hasSharedStrings()   X-Ref
Returns whether the XLSX file contains a shared strings XML file

return: bool

extractSharedStrings()   X-Ref
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.
Please note that SimpleXML does not provide such a functionality but since it is faster
and more handy to parse few XML nodes, it is used in combination with XMLReader for that purpose.

return: void

getSharedStringsFilePath()   X-Ref

return: string The path to the shared strings XML file

getSharedStringsUniqueCount($xmlReader)   X-Ref
Returns the shared strings unique count, as specified in <sst> tag.

param: \Box\Spout\Reader\Wrapper\XMLReader $xmlReader XMLReader instance
return: int Number of unique shared strings in the sharedStrings.xml file

getBestSharedStringsCachingStrategy($sharedStringsUniqueCount)   X-Ref
Returns the best shared strings caching strategy.

param: int $sharedStringsUniqueCount
return: CachingStrategyInterface

getSimpleXmlElementNodeFromXMLReader($xmlReader)   X-Ref
Returns a SimpleXMLElement node from the current node in the given XMLReader instance.
This is to simplify the parsing of the subtree.

param: \Box\Spout\Reader\Wrapper\XMLReader $xmlReader
return: \Box\Spout\Reader\Wrapper\SimpleXMLElement

removeSuperfluousTextNodes($parentNode)   X-Ref
Removes nodes that should not be read, like the pronunciation of the Kanji characters.
By keeping them, their text content would be added to the read string.

param: \Box\Spout\Reader\Wrapper\SimpleXMLElement $parentNode Parent node that may contain nodes to remove
return: \Box\Spout\Reader\Wrapper\SimpleXMLElement Cleaned parent node

shouldPreserveWhitespace($textNode)   X-Ref
If the text node has the attribute 'xml:space="preserve"', then preserve whitespace.

param: \Box\Spout\Reader\Wrapper\SimpleXMLElement $textNode The text node element (<t>) whitespace may be preserved
return: bool Whether whitespace should be preserved

getStringAtIndex($sharedStringIndex)   X-Ref
Returns the shared string at the given index, using the previously chosen caching strategy.

param: int $sharedStringIndex Index of the shared string in the sharedStrings.xml file
return: string The shared string at the given index

cleanup()   X-Ref
Destroys the cache, freeing memory and removing any created artifacts

return: void



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1