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

Public Member Functions

 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...
 
- Public Member Functions inherited from PhpOffice\PhpSpreadsheet\Writer\IWriter
 __construct (Spreadsheet $spreadsheet)
 IWriter constructor. More...
 
 save ($pFilename)
 Save PhpSpreadsheet to file. More...
 

Protected Member Functions

 maybeCloseFileHandle ()
 Close file handle only if we opened it ourselves. More...
 

Protected Attributes

 $includeCharts = false
 
 $preCalculateFormulas = true
 
 $fileHandle
 

Private Attributes

 $useDiskCaching = false
 
 $diskCachingDirectory = './'
 
 $shouldCloseFile
 

Detailed Description

Definition at line 5 of file BaseWriter.php.

Member Function Documentation

◆ getDiskCachingDirectory()

PhpOffice\PhpSpreadsheet\Writer\BaseWriter::getDiskCachingDirectory ( )

Get disk caching directory.

Returns
string

Implements PhpOffice\PhpSpreadsheet\Writer\IWriter.

Definition at line 92 of file BaseWriter.php.

References PhpOffice\PhpSpreadsheet\Writer\BaseWriter\$diskCachingDirectory.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\Styles\write(), PhpOffice\PhpSpreadsheet\Writer\Ods\MetaInf\write(), PhpOffice\PhpSpreadsheet\Writer\Ods\Settings\write(), PhpOffice\PhpSpreadsheet\Writer\Ods\Meta\write(), PhpOffice\PhpSpreadsheet\Writer\Ods\Content\write(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Chart\writeChart(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Comments\writeComments(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\ContentTypes\writeContentTypes(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\DocProps\writeDocPropsApp(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\DocProps\writeDocPropsCore(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\DocProps\writeDocPropsCustom(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels\writeHeaderFooterDrawingRelationships(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels\writeRelationships(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsRibbon\writeRibbonRelationships(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\StringTable\writeStringTable(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style\writeStyles(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Theme\writeTheme(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels\writeUnparsedRelationship(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsVBA\writeVBARelationships(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Comments\writeVMLComments(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Drawing\writeVMLHeaderFooterImages(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Workbook\writeWorkbook(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels\writeWorkbookRelationships(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet\writeWorksheet(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels\writeWorksheetRelationships().

+ Here is the caller graph for this function:

◆ getIncludeCharts()

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.

If false (the default) it will ignore any charts defined in the PhpSpreadsheet object.

Returns
bool

Implements PhpOffice\PhpSpreadsheet\Writer\IWriter.

Definition at line 48 of file BaseWriter.php.

References PhpOffice\PhpSpreadsheet\Writer\BaseWriter\$includeCharts.

◆ getPreCalculateFormulas()

PhpOffice\PhpSpreadsheet\Writer\BaseWriter::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.

This is faster for saving in PhpSpreadsheet, but slower when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself.

Returns
bool

Implements PhpOffice\PhpSpreadsheet\Writer\IWriter.

Definition at line 60 of file BaseWriter.php.

References PhpOffice\PhpSpreadsheet\Writer\BaseWriter\$preCalculateFormulas.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet\writeCellFormula(), and PhpOffice\PhpSpreadsheet\Writer\Ods\Content\writeRows().

+ Here is the caller graph for this function:

◆ getUseDiskCaching()

PhpOffice\PhpSpreadsheet\Writer\BaseWriter::getUseDiskCaching ( )

Get use disk caching where possible?

Returns
bool

Implements PhpOffice\PhpSpreadsheet\Writer\IWriter.

Definition at line 72 of file BaseWriter.php.

References PhpOffice\PhpSpreadsheet\Writer\BaseWriter\$useDiskCaching.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Ods\Styles\write(), PhpOffice\PhpSpreadsheet\Writer\Ods\MetaInf\write(), PhpOffice\PhpSpreadsheet\Writer\Ods\Settings\write(), PhpOffice\PhpSpreadsheet\Writer\Ods\Meta\write(), PhpOffice\PhpSpreadsheet\Writer\Ods\Content\write(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Chart\writeChart(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Comments\writeComments(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\ContentTypes\writeContentTypes(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\DocProps\writeDocPropsApp(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\DocProps\writeDocPropsCore(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\DocProps\writeDocPropsCustom(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels\writeHeaderFooterDrawingRelationships(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels\writeRelationships(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsRibbon\writeRibbonRelationships(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\StringTable\writeStringTable(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style\writeStyles(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Theme\writeTheme(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels\writeUnparsedRelationship(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsVBA\writeVBARelationships(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Comments\writeVMLComments(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Drawing\writeVMLHeaderFooterImages(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Workbook\writeWorkbook(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels\writeWorkbookRelationships(), PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet\writeWorksheet(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels\writeWorksheetRelationships().

+ Here is the caller graph for this function:

◆ maybeCloseFileHandle()

PhpOffice\PhpSpreadsheet\Writer\BaseWriter::maybeCloseFileHandle ( )
protected

Close file handle only if we opened it ourselves.

Definition at line 123 of file BaseWriter.php.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Pdf\restoreStateAfterSave(), PhpOffice\PhpSpreadsheet\Writer\Csv\save(), PhpOffice\PhpSpreadsheet\Writer\Ods\save(), PhpOffice\PhpSpreadsheet\Writer\Xls\save(), PhpOffice\PhpSpreadsheet\Writer\Html\save(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\save().

123  : void
124  {
125  if ($this->shouldCloseFile) {
126  if (!fclose($this->fileHandle)) {
127  throw new Exception('Could not close file after writing.');
128  }
129  }
130  }
+ Here is the caller graph for this function:

◆ openFileHandle()

PhpOffice\PhpSpreadsheet\Writer\BaseWriter::openFileHandle (   $filename)

Open file handle.

Parameters
resource | string$filename

Definition at line 102 of file BaseWriter.php.

References PhpOffice\PhpSpreadsheet\Writer\BaseWriter\$fileHandle, and $filename.

Referenced by PhpOffice\PhpSpreadsheet\Writer\Pdf\prepareForSave(), PhpOffice\PhpSpreadsheet\Writer\Csv\save(), PhpOffice\PhpSpreadsheet\Writer\Ods\save(), PhpOffice\PhpSpreadsheet\Writer\Xls\save(), PhpOffice\PhpSpreadsheet\Writer\Html\save(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\save().

102  : void
103  {
104  if (is_resource($filename)) {
105  $this->fileHandle = $filename;
106  $this->shouldCloseFile = false;
107 
108  return;
109  }
110 
111  $fileHandle = $filename ? fopen($filename, 'wb+') : false;
112  if ($fileHandle === false) {
113  throw new Exception('Could not open file "' . $filename . '" for writing.');
114  }
115 
116  $this->fileHandle = $fileHandle;
117  $this->shouldCloseFile = true;
118  }
$filename
Definition: buildRTE.php:89
+ Here is the caller graph for this function:

◆ setIncludeCharts()

PhpOffice\PhpSpreadsheet\Writer\BaseWriter::setIncludeCharts (   $pValue)

Set write charts in workbook Set to true, to advise the Writer to include any charts that exist in the PhpSpreadsheet object.

Set to false (the default) to ignore charts.

Parameters
bool$pValue
Returns
IWriter

Implements PhpOffice\PhpSpreadsheet\Writer\IWriter.

Definition at line 53 of file BaseWriter.php.

54  {
55  $this->includeCharts = (bool) $pValue;
56 
57  return $this;
58  }

◆ setPreCalculateFormulas()

PhpOffice\PhpSpreadsheet\Writer\BaseWriter::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.

Parameters
bool$pValuePre-Calculate Formulas?
Returns
IWriter

Implements PhpOffice\PhpSpreadsheet\Writer\IWriter.

Definition at line 65 of file BaseWriter.php.

66  {
67  $this->preCalculateFormulas = (bool) $pValue;
68 
69  return $this;
70  }

◆ setUseDiskCaching()

PhpOffice\PhpSpreadsheet\Writer\BaseWriter::setUseDiskCaching (   $pValue,
  $pDirectory = null 
)

Set use disk caching where possible?

Parameters
bool$pValue
string$pDirectoryDisk caching directory
Returns
IWriter

Implements PhpOffice\PhpSpreadsheet\Writer\IWriter.

Definition at line 77 of file BaseWriter.php.

78  {
79  $this->useDiskCaching = $pValue;
80 
81  if ($pDirectory !== null) {
82  if (is_dir($pDirectory)) {
83  $this->diskCachingDirectory = $pDirectory;
84  } else {
85  throw new Exception("Directory does not exist: $pDirectory");
86  }
87  }
88 
89  return $this;
90  }

Field Documentation

◆ $diskCachingDirectory

PhpOffice\PhpSpreadsheet\Writer\BaseWriter::$diskCachingDirectory = './'
private

◆ $fileHandle

◆ $includeCharts

◆ $preCalculateFormulas

PhpOffice\PhpSpreadsheet\Writer\BaseWriter::$preCalculateFormulas = true
protected

◆ $shouldCloseFile

PhpOffice\PhpSpreadsheet\Writer\BaseWriter::$shouldCloseFile
private

Definition at line 46 of file BaseWriter.php.

◆ $useDiskCaching

PhpOffice\PhpSpreadsheet\Writer\BaseWriter::$useDiskCaching = false
private

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