ODS writer

Added ODS writer
Refactored XLSX writer to abstract some pieces into an abstract multi-sheets writer
Created an abstract style helper
Moved shared components around
This commit is contained in:
Adrien Loison committed 2015-08-28 20:19:45 -07:00
1 parent a8f1fba854
commit 5949cb2442
39 files changed
+2924 -533

No files matched your search

@@ -2,6 +2,7 @@
namespace Box\Spout\Writer\XLSX\Helper;
use Box\Spout\Writer\Common\Helper\ZipHelper;
use Box\Spout\Writer\XLSX\Internal\Worksheet;
/**
@@ -284,6 +285,7 @@ EOD;
EOD;
/** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
$escaper = new \Box\Spout\Common\Escaper\XLSX();
/** @var Worksheet $worksheet */
@@ -354,42 +356,10 @@ EOD;
*/
public function zipRootFolderAndCopyToStream($streamPointer)
{
$this->zipRootFolder();
$this->copyZipToStream($streamPointer);
$zipHelper = new ZipHelper();
$zipHelper->zipFolderAndCopyToStream($this->rootFolder, $streamPointer);
// once the zip is copied, remove it
$this->deleteFile($this->getZipFilePath());
}
/**
* Zips the root folder
*
* @return void
*/
protected function zipRootFolder()
{
$zipHelper = new ZipHelper();
$zipHelper->zipFolder($this->rootFolder, $this->getZipFilePath());
}
/**
* @return string Path of the zip file created from the root folder
*/
protected function getZipFilePath()
{
return $this->rootFolder . '.zip';
}
/**
* Streams the contents of the zip into the given stream
*
* @param resource $pointer Pointer to the stream to copy the zip
* @return void
*/
protected function copyZipToStream($pointer)
{
$zipFilePointer = fopen($this->getZipFilePath(), 'r');
stream_copy_to_stream($zipFilePointer, $pointer);
fclose($zipFilePointer);
$this->deleteFile($zipHelper->getZipFilePath($this->rootFolder));
}
}