63 $writerPartsArray =
array(
64 'content' =>
'PHPExcel_Writer_OpenDocument_Content',
65 'meta' =>
'PHPExcel_Writer_OpenDocument_Meta',
66 'meta_inf' =>
'PHPExcel_Writer_OpenDocument_MetaInf',
67 'mimetype' =>
'PHPExcel_Writer_OpenDocument_Mimetype',
68 'settings' =>
'PHPExcel_Writer_OpenDocument_Settings',
69 'styles' =>
'PHPExcel_Writer_OpenDocument_Styles',
70 'thumbnails' =>
'PHPExcel_Writer_OpenDocument_Thumbnails' 73 foreach ($writerPartsArray as $writer => $class) {
74 $this->_writerParts[$writer] =
new $class($this);
86 if ($pPartName !=
'' && isset($this->_writerParts[strtolower($pPartName)])) {
87 return $this->_writerParts[strtolower($pPartName)];
99 public function save($pFilename = NULL)
101 if (!$this->_spreadSheet) {
106 $this->_spreadSheet->garbageCollect();
109 $originalFilename = $pFilename;
110 if (strtolower($pFilename) ==
'php://output' || strtolower($pFilename) ==
'php://stdout') {
112 if ($pFilename ==
'') {
113 $pFilename = $originalFilename;
119 $objZip->addFromString(
'META-INF/manifest.xml', $this->
getWriterPart(
'meta_inf')->writeManifest());
120 $objZip->addFromString(
'Thumbnails/thumbnail.png', $this->
getWriterPart(
'thumbnails')->writeThumbnail());
121 $objZip->addFromString(
'content.xml', $this->
getWriterPart(
'content')->write());
122 $objZip->addFromString(
'meta.xml', $this->
getWriterPart(
'meta')->write());
123 $objZip->addFromString(
'mimetype', $this->
getWriterPart(
'mimetype')->write());
124 $objZip->addFromString(
'settings.xml', $this->
getWriterPart(
'settings')->write());
125 $objZip->addFromString(
'styles.xml', $this->
getWriterPart(
'styles')->write());
128 if ($objZip->close() ===
false) {
133 if ($originalFilename != $pFilename) {
134 if (copy($pFilename, $originalFilename) ===
false) {
152 $objZip =
new $zipClass();
156 $ro =
new ReflectionObject($objZip);
157 $zipOverWrite = $ro->getConstant(
'OVERWRITE');
158 $zipCreate = $ro->getConstant(
'CREATE');
160 if (file_exists($pFilename)) {
164 if ($objZip->open($pFilename, $zipOverWrite) !==
true) {
165 if ($objZip->open($pFilename, $zipCreate) !==
true) {
181 if ($this->_spreadSheet !== null) {
197 $this->_spreadSheet = $pPHPExcel;
static getZipClass()
Return the name of the Zip handler Class that PHPExcel is configured to use (PCLZip or ZipArchive) or...
__construct(PHPExcel $pPHPExcel=null)
Create a new PHPExcel_Writer_OpenDocument.
static sys_get_temp_dir()
Get the systems temporary directory.
_createZip($pFilename)
Create zip object.
save($pFilename=NULL)
Save PHPExcel to file.
Create styles array
The data for the language used.
getWriterPart($pPartName='')
Get writer part.
getPHPExcel()
Get PHPExcel object.
setPHPExcel(PHPExcel $pPHPExcel=null)
Set PHPExcel object.