ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PhpOffice\PhpSpreadsheet\Writer\Ods Class Reference
+ Inheritance diagram for PhpOffice\PhpSpreadsheet\Writer\Ods:
+ Collaboration diagram for PhpOffice\PhpSpreadsheet\Writer\Ods:

Public Member Functions

 __construct (Spreadsheet $spreadsheet)
 Create a new Ods. More...
 
 getWriterPartContent ()
 
 getWriterPartMeta ()
 
 getWriterPartMetaInf ()
 
 getWriterPartMimetype ()
 
 getWriterPartSettings ()
 
 getWriterPartStyles ()
 
 getWriterPartThumbnails ()
 
 save ($pFilename)
 Save PhpSpreadsheet to file. More...
 
 getSpreadsheet ()
 Get Spreadsheet object. More...
 
 setSpreadsheet (Spreadsheet $spreadsheet)
 Set Spreadsheet object. More...
 
- Public Member Functions inherited from PhpOffice\PhpSpreadsheet\Writer\BaseWriter
 getIncludeCharts ()
 Write charts in workbook? If this is true, then the Writer will write definitions for any charts that exist in the PhpSpreadsheet object. More...
 
 setIncludeCharts ($pValue)
 Set write charts in workbook Set to true, to advise the Writer to include any charts that exist in the PhpSpreadsheet 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)
 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, $pDirectory=null)
 Set use disk caching where possible? More...
 
 getDiskCachingDirectory ()
 Get disk caching directory. More...
 
 openFileHandle ($filename)
 Open file handle. More...
 

Private Member Functions

 createZip ()
 Create zip object. More...
 

Private Attributes

 $spreadSheet
 
 $writerPartContent
 
 $writerPartMeta
 
 $writerPartMetaInf
 
 $writerPartMimetype
 
 $writerPartSettings
 
 $writerPartStyles
 
 $writerPartThumbnails
 

Additional Inherited Members

- Protected Member Functions inherited from PhpOffice\PhpSpreadsheet\Writer\BaseWriter
 maybeCloseFileHandle ()
 Close file handle only if we opened it ourselves. More...
 
- Protected Attributes inherited from PhpOffice\PhpSpreadsheet\Writer\BaseWriter
 $includeCharts = false
 
 $preCalculateFormulas = true
 
 $fileHandle
 

Detailed Description

Definition at line 18 of file Ods.php.

Constructor & Destructor Documentation

◆ __construct()

PhpOffice\PhpSpreadsheet\Writer\Ods::__construct ( Spreadsheet  $spreadsheet)

Create a new Ods.

Implements PhpOffice\PhpSpreadsheet\Writer\IWriter.

Definition at line 65 of file Ods.php.

References PhpOffice\PhpSpreadsheet\Writer\Ods\setSpreadsheet().

66  {
67  $this->setSpreadsheet($spreadsheet);
68 
69  $this->writerPartContent = new Content($this);
70  $this->writerPartMeta = new Meta($this);
71  $this->writerPartMetaInf = new MetaInf($this);
72  $this->writerPartMimetype = new Mimetype($this);
73  $this->writerPartSettings = new Settings($this);
74  $this->writerPartStyles = new Styles($this);
75  $this->writerPartThumbnails = new Thumbnails($this);
76  }
setSpreadsheet(Spreadsheet $spreadsheet)
Set Spreadsheet object.
Definition: Ods.php:190
+ Here is the call graph for this function:

Member Function Documentation

◆ createZip()

PhpOffice\PhpSpreadsheet\Writer\Ods::createZip ( )
private

Create zip object.

Returns
ZipStream

Definition at line 154 of file Ods.php.

References PHPMailer\PHPMailer\$options.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\save().

155  {
156  // Try opening the ZIP file
157  if (!is_resource($this->fileHandle)) {
158  throw new WriterException('Could not open resource for writing.');
159  }
160 
161  // Create new ZIP stream
162  $options = new Archive();
163  $options->setEnableZip64(false);
164  $options->setOutputStream($this->fileHandle);
165 
166  return new ZipStream(null, $options);
167  }
Class Version .
Definition: Bigint.php:4
+ Here is the caller graph for this function:

◆ getSpreadsheet()

PhpOffice\PhpSpreadsheet\Writer\Ods::getSpreadsheet ( )

Get Spreadsheet object.

Returns
Spreadsheet

Definition at line 174 of file Ods.php.

References PhpOffice\PhpSpreadsheet\Writer\Ods\$spreadSheet.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\Content\__construct(), and PhpOffice\PhpSpreadsheet\Writer\Ods\Content\write().

175  {
176  if ($this->spreadSheet !== null) {
177  return $this->spreadSheet;
178  }
179 
180  throw new WriterException('No PhpSpreadsheet assigned.');
181  }
+ Here is the caller graph for this function:

◆ getWriterPartContent()

PhpOffice\PhpSpreadsheet\Writer\Ods::getWriterPartContent ( )

Definition at line 78 of file Ods.php.

References PhpOffice\PhpSpreadsheet\Writer\Ods\$writerPartContent.

78  : Content
79  {
81  }

◆ getWriterPartMeta()

PhpOffice\PhpSpreadsheet\Writer\Ods::getWriterPartMeta ( )

Definition at line 83 of file Ods.php.

References PhpOffice\PhpSpreadsheet\Writer\Ods\$writerPartMeta.

83  : Meta
84  {
85  return $this->writerPartMeta;
86  }

◆ getWriterPartMetaInf()

PhpOffice\PhpSpreadsheet\Writer\Ods::getWriterPartMetaInf ( )

Definition at line 88 of file Ods.php.

References PhpOffice\PhpSpreadsheet\Writer\Ods\$writerPartMetaInf.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\save().

88  : MetaInf
89  {
91  }
+ Here is the caller graph for this function:

◆ getWriterPartMimetype()

PhpOffice\PhpSpreadsheet\Writer\Ods::getWriterPartMimetype ( )

Definition at line 93 of file Ods.php.

References PhpOffice\PhpSpreadsheet\Writer\Ods\$writerPartMimetype.

93  : Mimetype
94  {
96  }

◆ getWriterPartSettings()

PhpOffice\PhpSpreadsheet\Writer\Ods::getWriterPartSettings ( )

Definition at line 98 of file Ods.php.

References PhpOffice\PhpSpreadsheet\Writer\Ods\$writerPartSettings.

98  : Settings
99  {
101  }

◆ getWriterPartStyles()

PhpOffice\PhpSpreadsheet\Writer\Ods::getWriterPartStyles ( )

Definition at line 103 of file Ods.php.

References PhpOffice\PhpSpreadsheet\Writer\Ods\$writerPartStyles.

103  : Styles
104  {
106  }

◆ getWriterPartThumbnails()

PhpOffice\PhpSpreadsheet\Writer\Ods::getWriterPartThumbnails ( )

Definition at line 108 of file Ods.php.

References PhpOffice\PhpSpreadsheet\Writer\Ods\$writerPartThumbnails.

108  : Thumbnails
109  {
111  }

◆ save()

PhpOffice\PhpSpreadsheet\Writer\Ods::save (   $pFilename)

Save PhpSpreadsheet to file.

Parameters
resource | string$pFilename

Implements PhpOffice\PhpSpreadsheet\Writer\IWriter.

Definition at line 118 of file Ods.php.

References PhpOffice\PhpSpreadsheet\Writer\Ods\createZip(), PhpOffice\PhpSpreadsheet\Writer\Ods\getWriterPartMetaInf(), PhpOffice\PhpSpreadsheet\Writer\BaseWriter\maybeCloseFileHandle(), PhpOffice\PhpSpreadsheet\Writer\BaseWriter\openFileHandle(), and Sabre\VObject\write().

118  : void
119  {
120  if (!$this->spreadSheet) {
121  throw new WriterException('PhpSpreadsheet object unassigned.');
122  }
123 
124  // garbage collect
125  $this->spreadSheet->garbageCollect();
126 
127  $this->openFileHandle($pFilename);
128 
129  $zip = $this->createZip();
130 
131  $zip->addFile('META-INF/manifest.xml', $this->getWriterPartMetaInf()->write());
132  $zip->addFile('Thumbnails/thumbnail.png', $this->getWriterPartthumbnails()->write());
133  $zip->addFile('content.xml', $this->getWriterPartcontent()->write());
134  $zip->addFile('meta.xml', $this->getWriterPartmeta()->write());
135  $zip->addFile('mimetype', $this->getWriterPartmimetype()->write());
136  $zip->addFile('settings.xml', $this->getWriterPartsettings()->write());
137  $zip->addFile('styles.xml', $this->getWriterPartstyles()->write());
138 
139  // Close file
140  try {
141  $zip->finish();
142  } catch (OverflowException $e) {
143  throw new WriterException('Could not close resource.');
144  }
145 
146  $this->maybeCloseFileHandle();
147  }
createZip()
Create zip object.
Definition: Ods.php:154
openFileHandle($filename)
Open file handle.
Definition: BaseWriter.php:102
maybeCloseFileHandle()
Close file handle only if we opened it ourselves.
Definition: BaseWriter.php:123
+ Here is the call graph for this function:

◆ setSpreadsheet()

PhpOffice\PhpSpreadsheet\Writer\Ods::setSpreadsheet ( Spreadsheet  $spreadsheet)

Set Spreadsheet object.

Parameters
Spreadsheet$spreadsheetPhpSpreadsheet object
Returns
$this

Definition at line 190 of file Ods.php.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\__construct().

191  {
192  $this->spreadSheet = $spreadsheet;
193 
194  return $this;
195  }
+ Here is the caller graph for this function:

Field Documentation

◆ $spreadSheet

PhpOffice\PhpSpreadsheet\Writer\Ods::$spreadSheet
private

Definition at line 25 of file Ods.php.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\getSpreadsheet().

◆ $writerPartContent

PhpOffice\PhpSpreadsheet\Writer\Ods::$writerPartContent
private

Definition at line 30 of file Ods.php.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\getWriterPartContent().

◆ $writerPartMeta

PhpOffice\PhpSpreadsheet\Writer\Ods::$writerPartMeta
private

Definition at line 35 of file Ods.php.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\getWriterPartMeta().

◆ $writerPartMetaInf

PhpOffice\PhpSpreadsheet\Writer\Ods::$writerPartMetaInf
private

Definition at line 40 of file Ods.php.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\getWriterPartMetaInf().

◆ $writerPartMimetype

PhpOffice\PhpSpreadsheet\Writer\Ods::$writerPartMimetype
private

Definition at line 45 of file Ods.php.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\getWriterPartMimetype().

◆ $writerPartSettings

PhpOffice\PhpSpreadsheet\Writer\Ods::$writerPartSettings
private

Definition at line 50 of file Ods.php.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\getWriterPartSettings().

◆ $writerPartStyles

PhpOffice\PhpSpreadsheet\Writer\Ods::$writerPartStyles
private

Definition at line 55 of file Ods.php.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\getWriterPartStyles().

◆ $writerPartThumbnails

PhpOffice\PhpSpreadsheet\Writer\Ods::$writerPartThumbnails
private

Definition at line 60 of file Ods.php.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\getWriterPartThumbnails().


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