Support XLSX that don't have a sharedStrings.xml file

This commit is contained in:
Adrien Loison committed 2015-05-28 17:59:30 -07:00
1 parent f8f194bc8f
commit 04d41d7c9f
4 files changed
+38 -15

No files matched your search

+6 -15
View File
@@ -72,8 +72,12 @@ class XLSX extends AbstractReader
$this->zip = new \ZipArchive();
if ($this->zip->open($filePath) === true) {
// Extracts all the strings from the worksheets for easy access in the future
$this->extractSharedStrings($filePath);
$this->sharedStringsHelper = new SharedStringsHelper($filePath, $this->tempFolder);
if ($this->sharedStringsHelper->hasSharedStrings()) {
// Extracts all the strings from the worksheets for easy access in the future
$this->sharedStringsHelper->extractSharedStrings();
}
// Fetch all available worksheets
$this->worksheetHelper = new WorksheetHelper($filePath, $this->globalFunctionsHelper);
@@ -87,19 +91,6 @@ class XLSX extends AbstractReader
}
}
/**
* Builds an in-memory array containing all the shared strings of the worksheets.
*
* @param string $filePath Path of the XLSX file to be read
* @return void
* @throws \Box\Spout\Common\Exception\IOException If sharedStrings XML file can't be read
*/
protected function extractSharedStrings($filePath)
{
$this->sharedStringsHelper = new SharedStringsHelper($filePath, $this->tempFolder);
$this->sharedStringsHelper->extractSharedStrings();
}
/**
* Returns whether another worksheet exists after the current worksheet.
*