Documentation

Xlsx extends BaseWriter
in package

Table of Contents

Properties

$fileHandle  : resource
$includeCharts  : bool
Write charts that are defined in the workbook? Identifies whether the Writer should write definitions for any charts that exist in the PhpSpreadsheet object.
$preCalculateFormulas  : bool
Pre-calculate formulas Forces PhpSpreadsheet to 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.
$bordersHashTable  : HashTable<string|int, Borders>
Private unique Borders HashTable.
$diskCachingDirectory  : string
Disk caching directory.
$drawingHashTable  : HashTable<string|int, BaseDrawing>
Private unique \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\BaseDrawing HashTable.
$fillHashTable  : HashTable<string|int, Fill>
Private unique Fill HashTable.
$fontHashTable  : HashTable<string|int, Font>
Private unique \PhpOffice\PhpSpreadsheet\Style\Font HashTable.
$numFmtHashTable  : HashTable<string|int, NumberFormat>
Private unique NumberFormat HashTable.
$office2003compatibility  : bool
Office2003 compatibility.
$pathNames  : array<string|int, mixed>
$shouldCloseFile  : bool
$spreadSheet  : Spreadsheet
Private Spreadsheet.
$stringTable  : array<string|int, string>
Private string table.
$styleHashTable  : HashTable<string|int, Style>
Private unique Style HashTable.
$stylesConditionalHashTable  : HashTable<string|int, Conditional>
Private unique Conditional HashTable.
$useDiskCaching  : bool
Use disk caching where possible?
$writerPartChart  : Chart
$writerPartComments  : Comments
$writerPartContentTypes  : ContentTypes
$writerPartDocProps  : DocProps
$writerPartDrawing  : Drawing
$writerPartRels  : Rels
$writerPartRelsRibbon  : RelsRibbon
$writerPartRelsVBA  : RelsVBA
$writerPartStringTable  : StringTable
$writerPartStyle  : Style
$writerPartTable  : Table
$writerPartTheme  : Theme
$writerPartWorkbook  : Workbook
$writerPartWorksheet  : Worksheet
$zip  : ZipStream
Private handle for zip stream.

Methods

__construct()  : mixed
Create a new Xlsx Writer.
getBordersHashTable()  : HashTable<string|int, Borders>
Get Borders HashTable.
getDiskCachingDirectory()  : string
Get disk caching directory.
getDrawingHashTable()  : HashTable<string|int, BaseDrawing>
Get \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\BaseDrawing HashTable.
getFillHashTable()  : HashTable<string|int, Fill>
Get Fill HashTable.
getFontHashTable()  : HashTable<string|int, Font>
Get \PhpOffice\PhpSpreadsheet\Style\Font HashTable.
getIncludeCharts()  : bool
Write charts in workbook? If this is true, then the Writer will write definitions for any charts that exist in the PhpSpreadsheet object.
getNumFmtHashTable()  : HashTable<string|int, NumberFormat>
Get NumberFormat HashTable.
getOffice2003Compatibility()  : bool
Get Office2003 compatibility.
getPreCalculateFormulas()  : bool
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.
getSpreadsheet()  : Spreadsheet
Get Spreadsheet object.
getStringTable()  : array<string|int, string>
Get string table.
getStyleHashTable()  : HashTable<string|int, Style>
Get Style HashTable.
getStylesConditionalHashTable()  : HashTable<string|int, Conditional>
Get Conditional HashTable.
getUseDiskCaching()  : bool
Get use disk caching where possible?
getWriterPartChart()  : Chart
getWriterPartComments()  : Comments
getWriterPartContentTypes()  : ContentTypes
getWriterPartDocProps()  : DocProps
getWriterPartDrawing()  : Drawing
getWriterPartRels()  : Rels
getWriterPartRelsRibbon()  : RelsRibbon
getWriterPartRelsVBA()  : RelsVBA
getWriterPartStringTable()  : StringTable
getWriterPartStyle()  : Style
getWriterPartTable()  : Table
getWriterPartTheme()  : Theme
getWriterPartWorkbook()  : Workbook
getWriterPartWorksheet()  : Worksheet
openFileHandle()  : void
Open file handle.
save()  : void
Save PhpSpreadsheet to file.
setIncludeCharts()  : $this
Set write charts in workbook Set to true, to advise the Writer to include any charts that exist in the PhpSpreadsheet object.
setOffice2003Compatibility()  : $this
Set Office2003 compatibility.
setPreCalculateFormulas()  : $this
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.
setSpreadsheet()  : $this
Set Spreadsheet object.
setUseDiskCaching()  : $this
Set use disk caching where possible?
maybeCloseFileHandle()  : void
Close file handle only if we opened it ourselves.
processFlags()  : void
addZipFile()  : void
addZipFiles()  : void
processDrawing()  : string|null|false

Properties

$includeCharts

Write charts that are defined in the workbook? Identifies whether the Writer should write definitions for any charts that exist in the PhpSpreadsheet object.

protected bool $includeCharts = false

$preCalculateFormulas

Pre-calculate formulas Forces PhpSpreadsheet to 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.

protected bool $preCalculateFormulas = true

$bordersHashTable

Private unique Borders HashTable.

private HashTable<string|int, Borders> $bordersHashTable

$diskCachingDirectory

Disk caching directory.

private string $diskCachingDirectory = './'

$drawingHashTable

Private unique \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\BaseDrawing HashTable.

private HashTable<string|int, BaseDrawing> $drawingHashTable

$fillHashTable

Private unique Fill HashTable.

private HashTable<string|int, Fill> $fillHashTable

$fontHashTable

Private unique \PhpOffice\PhpSpreadsheet\Style\Font HashTable.

private HashTable<string|int, Font> $fontHashTable

$office2003compatibility

Office2003 compatibility.

private bool $office2003compatibility = false

$pathNames

private array<string|int, mixed> $pathNames = []

$stringTable

Private string table.

private array<string|int, string> $stringTable = []

$styleHashTable

Private unique Style HashTable.

private HashTable<string|int, Style> $styleHashTable

$stylesConditionalHashTable

Private unique Conditional HashTable.

private HashTable<string|int, Conditional> $stylesConditionalHashTable

$useDiskCaching

Use disk caching where possible?

private bool $useDiskCaching = false

$writerPartRels

private Rels $writerPartRels

$zip

Private handle for zip stream.

private ZipStream $zip

Methods

getDiskCachingDirectory()

Get disk caching directory.

public getDiskCachingDirectory() : string
Return values
string

getFontHashTable()

Get \PhpOffice\PhpSpreadsheet\Style\Font HashTable.

public getFontHashTable() : HashTable<string|int, Font>
Return values
HashTable<string|int, Font>

getIncludeCharts()

Write charts in workbook? If this is true, then the Writer will write definitions for any charts that exist in the PhpSpreadsheet object.

public getIncludeCharts() : bool

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

Return values
bool

getOffice2003Compatibility()

Get Office2003 compatibility.

public getOffice2003Compatibility() : bool
Return values
bool

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.

public getPreCalculateFormulas() : bool
Return values
bool

getStringTable()

Get string table.

public getStringTable() : array<string|int, string>
Return values
array<string|int, string>

getUseDiskCaching()

Get use disk caching where possible?

public getUseDiskCaching() : bool
Return values
bool

getWriterPartChart()

public getWriterPartChart() : Chart
Return values
Chart

getWriterPartRels()

public getWriterPartRels() : Rels
Return values
Rels

getWriterPartStyle()

public getWriterPartStyle() : Style
Return values
Style

getWriterPartTable()

public getWriterPartTable() : Table
Return values
Table

getWriterPartTheme()

public getWriterPartTheme() : Theme
Return values
Theme

openFileHandle()

Open file handle.

public openFileHandle(resource|string $filename) : void
Parameters
$filename : resource|string

save()

Save PhpSpreadsheet to file.

public save(resource|string $filename[, int $flags = 0 ]) : void
Parameters
$filename : resource|string
$flags : int = 0

setIncludeCharts()

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

public setIncludeCharts(bool $includeCharts) : $this

Set to false (the default) to ignore charts.

Parameters
$includeCharts : bool
Return values
$this

setOffice2003Compatibility()

Set Office2003 compatibility.

public setOffice2003Compatibility(bool $office2003compatibility) : $this
Parameters
$office2003compatibility : bool

Office2003 compatibility?

Return values
$this

setPreCalculateFormulas()

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.

public setPreCalculateFormulas(bool $precalculateFormulas) : $this
Parameters
$precalculateFormulas : bool

Pre-Calculate Formulas?

Return values
$this

setSpreadsheet()

Set Spreadsheet object.

public setSpreadsheet(Spreadsheet $spreadsheet) : $this
Parameters
$spreadsheet : Spreadsheet

PhpSpreadsheet object

Return values
$this

setUseDiskCaching()

Set use disk caching where possible?

public setUseDiskCaching(bool $useDiskCache[, string|null $cacheDirectory = null ]) : $this
Parameters
$useDiskCache : bool
$cacheDirectory : string|null = null

Disk caching directory

Return values
$this

maybeCloseFileHandle()

Close file handle only if we opened it ourselves.

protected maybeCloseFileHandle() : void

processFlags()

protected processFlags(int $flags) : void
Parameters
$flags : int

addZipFile()

private addZipFile(string $path, string $content) : void
Parameters
$path : string
$content : string

addZipFiles()

private addZipFiles(array<string|int, mixed> $zipContent) : void
Parameters
$zipContent : array<string|int, mixed>

processDrawing()

private processDrawing(Drawing $drawing) : string|null|false
Parameters
$drawing : Drawing
Return values
string|null|false

        
On this page

Search results