/** * @param string $fileName * @return \DOMNode[] */ private function getCellElementsFromSheetXmlFile($fileName) { $cellElements = []; $resourcePath = $this->getGeneratedResourcePath($fileName); $pathToStylesXmlFile = $resourcePath . '#xl/worksheets/sheet1.xml'; $xmlReader = new \XMLReader(); $xmlReader->open('zip://' . $pathToStylesXmlFile); while ($xmlReader->read()) { if ($xmlReader->nodeType === \XMLReader::ELEMENT && $xmlReader->name === 'c') { $cellElements[] = $xmlReader->expand(); } } return $cellElements; }
/** * @param string $fileName * @param string $section * @return \DomElement */ private function getXmlSectionFromStylesXmlFile($fileName, $section) { $resourcePath = $this->getGeneratedResourcePath($fileName); $pathToStylesXmlFile = $resourcePath . '#styles.xml'; $xmlReader = new XMLReader(); $xmlReader->open('zip://' . $pathToStylesXmlFile); $xmlReader->readUntilNodeFound($section); return $xmlReader->expand(); }