ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
PHPExcel_Writer_OpenDocument Class Reference
+ Inheritance diagram for PHPExcel_Writer_OpenDocument:
+ Collaboration diagram for PHPExcel_Writer_OpenDocument:

Public Member Functions

 __construct (PHPExcel $pPHPExcel=null)
 Create a new PHPExcel_Writer_OpenDocument. More...
 
 getWriterPart ($pPartName='')
 Get writer part. More...
 
 save ($pFilename=NULL)
 Save PHPExcel to file. More...
 
 getPHPExcel ()
 Get PHPExcel object. More...
 
 setPHPExcel (PHPExcel $pPHPExcel=null)
 Set PHPExcel object. More...
 
- Public Member Functions inherited from PHPExcel_Writer_Abstract
 getIncludeCharts ()
 Write charts in workbook? If this is true, then the Writer will write definitions for any charts that exist in the PHPExcel object. More...
 
 setIncludeCharts ($pValue=FALSE)
 Set write charts in workbook Set to true, to advise the Writer to include any charts that exist in the PHPExcel object. More...
 
 getPreCalculateFormulas ()
 Get Pre-Calculate Formulas flag If this is true (the default), then the writer will recalculate all formulae in a workbook when saving, so that the pre-calculated values are immediately available to MS Excel or other office spreadsheet viewer when opening the file If false, then formulae are not calculated on save. More...
 
 setPreCalculateFormulas ($pValue=TRUE)
 Set Pre-Calculate Formulas Set to true (the default) to advise the Writer to calculate all formulae on save Set to false to prevent precalculation of formulae on save. More...
 
 getUseDiskCaching ()
 Get use disk caching where possible? More...
 
 setUseDiskCaching ($pValue=FALSE, $pDirectory=NULL)
 Set use disk caching where possible? More...
 
 getDiskCachingDirectory ()
 Get disk caching directory. More...
 
 save ($pFilename=NULL)
 Save PHPExcel to file. More...
 

Private Member Functions

 _createZip ($pFilename)
 Create zip object. More...
 

Private Attributes

 $_writerParts = array()
 
 $_spreadSheet
 

Additional Inherited Members

- Protected Attributes inherited from PHPExcel_Writer_Abstract
 $_includeCharts = FALSE
 
 $_preCalculateFormulas = TRUE
 
 $_useDiskCaching = FALSE
 
 $_diskCachingDirectory = './'
 

Detailed Description

Definition at line 38 of file OpenDocument.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_Writer_OpenDocument::__construct ( PHPExcel  $pPHPExcel = null)

Create a new PHPExcel_Writer_OpenDocument.

Parameters
PHPExcel$pPHPExcel

Definition at line 59 of file OpenDocument.php.

60 {
61 $this->setPHPExcel($pPHPExcel);
62
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'
71 );
72
73 foreach ($writerPartsArray as $writer => $class) {
74 $this->_writerParts[$writer] = new $class($this);
75 }
76 }
setPHPExcel(PHPExcel $pPHPExcel=null)
Set PHPExcel object.

References setPHPExcel().

+ Here is the call graph for this function:

Member Function Documentation

◆ _createZip()

PHPExcel_Writer_OpenDocument::_createZip (   $pFilename)
private

Create zip object.

Parameters
string$pFilename
Exceptions
PHPExcel_Writer_Exception
Returns
ZipArchive

Definition at line 148 of file OpenDocument.php.

149 {
150 // Create new ZIP file and open it for writing
151 $zipClass = PHPExcel_Settings::getZipClass();
152 $objZip = new $zipClass();
153
154 // Retrieve OVERWRITE and CREATE constants from the instantiated zip class
155 // This method of accessing constant values from a dynamic class should work with all appropriate versions of PHP
156 $ro = new ReflectionObject($objZip);
157 $zipOverWrite = $ro->getConstant('OVERWRITE');
158 $zipCreate = $ro->getConstant('CREATE');
159
160 if (file_exists($pFilename)) {
161 unlink($pFilename);
162 }
163 // Try opening the ZIP file
164 if ($objZip->open($pFilename, $zipOverWrite) !== true) {
165 if ($objZip->open($pFilename, $zipCreate) !== true) {
166 throw new PHPExcel_Writer_Exception("Could not open $pFilename for writing.");
167 }
168 }
169
170 return $objZip;
171 }
static getZipClass()
Return the name of the Zip handler Class that PHPExcel is configured to use (PCLZip or ZipArchive) or...
Definition: Settings.php:141

References PHPExcel_Settings\getZipClass().

Referenced by save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPHPExcel()

PHPExcel_Writer_OpenDocument::getPHPExcel ( )

Get PHPExcel object.

Returns
PHPExcel
Exceptions
PHPExcel_Writer_Exception

Definition at line 179 of file OpenDocument.php.

180 {
181 if ($this->_spreadSheet !== null) {
182 return $this->_spreadSheet;
183 } else {
184 throw new PHPExcel_Writer_Exception('No PHPExcel assigned.');
185 }
186 }

References $_spreadSheet.

◆ getWriterPart()

PHPExcel_Writer_OpenDocument::getWriterPart (   $pPartName = '')

Get writer part.

Parameters
string$pPartNameWriter part name
Returns
PHPExcel_Writer_Excel2007_WriterPart

Definition at line 84 of file OpenDocument.php.

85 {
86 if ($pPartName != '' && isset($this->_writerParts[strtolower($pPartName)])) {
87 return $this->_writerParts[strtolower($pPartName)];
88 } else {
89 return null;
90 }
91 }

Referenced by save().

+ Here is the caller graph for this function:

◆ save()

PHPExcel_Writer_OpenDocument::save (   $pFilename = NULL)

Save PHPExcel to file.

Parameters
string$pFilename
Exceptions
PHPExcel_Writer_Exception

Implements PHPExcel_Writer_IWriter.

Definition at line 99 of file OpenDocument.php.

100 {
101 if (!$this->_spreadSheet) {
102 throw new PHPExcel_Writer_Exception('PHPExcel object unassigned.');
103 }
104
105 // garbage collect
106 $this->_spreadSheet->garbageCollect();
107
108 // If $pFilename is php://output or php://stdout, make it a temporary file...
109 $originalFilename = $pFilename;
110 if (strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') {
111 $pFilename = @tempnam(PHPExcel_Shared_File::sys_get_temp_dir(), 'phpxltmp');
112 if ($pFilename == '') {
113 $pFilename = $originalFilename;
114 }
115 }
116
117 $objZip = $this->_createZip($pFilename);
118
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());
126
127 // Close file
128 if ($objZip->close() === false) {
129 throw new PHPExcel_Writer_Exception("Could not close zip file $pFilename.");
130 }
131
132 // If a temporary file was used, copy it to the correct file stream
133 if ($originalFilename != $pFilename) {
134 if (copy($pFilename, $originalFilename) === false) {
135 throw new PHPExcel_Writer_Exception("Could not copy temporary zip file $pFilename to $originalFilename.");
136 }
137 @unlink($pFilename);
138 }
139 }
static sys_get_temp_dir()
Get the systems temporary directory.
Definition: File.php:135
_createZip($pFilename)
Create zip object.
getWriterPart($pPartName='')
Get writer part.

References _createZip(), getWriterPart(), and PHPExcel_Shared_File\sys_get_temp_dir().

+ Here is the call graph for this function:

◆ setPHPExcel()

PHPExcel_Writer_OpenDocument::setPHPExcel ( PHPExcel  $pPHPExcel = null)

Set PHPExcel object.

Parameters
PHPExcel$pPHPExcelPHPExcel object
Exceptions
PHPExcel_Writer_Exception
Returns
PHPExcel_Writer_Excel2007

Definition at line 195 of file OpenDocument.php.

196 {
197 $this->_spreadSheet = $pPHPExcel;
198 return $this;
199 }

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $_spreadSheet

PHPExcel_Writer_OpenDocument::$_spreadSheet
private

Definition at line 52 of file OpenDocument.php.

Referenced by getPHPExcel().

◆ $_writerParts

PHPExcel_Writer_OpenDocument::$_writerParts = array()
private

Definition at line 45 of file OpenDocument.php.


The documentation for this class was generated from the following file: