class Xlsx extends BaseWriter (View source)

Properties

protected bool $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;. from BaseWriter
protected bool $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. from BaseWriter

Methods

bool
getIncludeCharts()

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

setIncludeCharts(bool $pValue)

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

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.

setPreCalculateFormulas(bool $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.

bool
getUseDiskCaching()

Get use disk caching where possible?

setUseDiskCaching(bool $pValue, string $pDirectory = null)

Set use disk caching where possible?

string
getDiskCachingDirectory()

Get disk caching directory.

__construct(Spreadsheet $spreadsheet)

Create a new Xlsx Writer.

getWriterPart(string $pPartName)

Get writer part.

save(string $pFilename)

Save PhpSpreadsheet to file.

getSpreadsheet()

Get Spreadsheet object.

setSpreadsheet(Spreadsheet $spreadsheet)

Set Spreadsheet object.

string[]
getStringTable()

Get string table.

getStyleHashTable()

Get Style HashTable.

getStylesConditionalHashTable()

Get Conditional HashTable.

getFillHashTable()

Get Fill HashTable.

getFontHashTable()

Get \PhpOffice\PhpSpreadsheet\Style\Font HashTable.

getBordersHashTable()

Get Borders HashTable.

getNumFmtHashTable()

Get NumberFormat HashTable.

getDrawingHashTable()

Get \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\BaseDrawing HashTable.

bool
getOffice2003Compatibility()

Get Office2003 compatibility.

setOffice2003Compatibility(bool $pValue)

Set Office2003 compatibility.

Details

bool 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.

Return Value

bool

IWriter setIncludeCharts(bool $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

Return Value

IWriter

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.

Return Value

bool

IWriter setPreCalculateFormulas(bool $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 $pValue Pre-Calculate Formulas?

Return Value

IWriter

bool getUseDiskCaching()

Get use disk caching where possible?

Return Value

bool

IWriter setUseDiskCaching(bool $pValue, string $pDirectory = null)

Set use disk caching where possible?

Parameters

bool $pValue
string $pDirectory Disk caching directory

Return Value

IWriter

Exceptions

Exception when directory does not exist

string getDiskCachingDirectory()

Get disk caching directory.

Return Value

string

__construct(Spreadsheet $spreadsheet)

Create a new Xlsx Writer.

Parameters

Spreadsheet $spreadsheet

WriterPart getWriterPart(string $pPartName)

Get writer part.

Parameters

string $pPartName Writer part name

Return Value

WriterPart

save(string $pFilename)

Save PhpSpreadsheet to file.

Parameters

string $pFilename Name of the file to save

Exceptions

Exception

Spreadsheet getSpreadsheet()

Get Spreadsheet object.

Return Value

Spreadsheet

Exceptions

Exception

Xlsx setSpreadsheet(Spreadsheet $spreadsheet)

Set Spreadsheet object.

Parameters

Spreadsheet $spreadsheet PhpSpreadsheet object

Return Value

Xlsx

string[] getStringTable()

Get string table.

Return Value

string[]

HashTable getStyleHashTable()

Get Style HashTable.

Return Value

HashTable

HashTable getStylesConditionalHashTable()

Get Conditional HashTable.

Return Value

HashTable

HashTable getFillHashTable()

Get Fill HashTable.

Return Value

HashTable

HashTable getFontHashTable()

Get \PhpOffice\PhpSpreadsheet\Style\Font HashTable.

Return Value

HashTable

HashTable getBordersHashTable()

Get Borders HashTable.

Return Value

HashTable

HashTable getNumFmtHashTable()

Get NumberFormat HashTable.

Return Value

HashTable

HashTable getDrawingHashTable()

Get \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\BaseDrawing HashTable.

Return Value

HashTable

bool getOffice2003Compatibility()

Get Office2003 compatibility.

Return Value

bool

Xlsx setOffice2003Compatibility(bool $pValue)

Set Office2003 compatibility.

Parameters

bool $pValue Office2003 compatibility?

Return Value

Xlsx