Xls
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.
- $colors : array<string|int, mixed>
- Color cache. Mapping between RGB value and color index.
- $diskCachingDirectory : string
- Disk caching directory.
- $documentSummaryInformation : string
- Extended OLE object document summary information.
- $IDCLs : array<string|int, mixed>
- Identifier clusters for drawings. Used in MSODRAWINGGROUP record.
- $parser : Parser
- Formula parser.
- $shouldCloseFile : bool
- $spreadsheet : Spreadsheet
- PhpSpreadsheet object.
- $strTable : array<string|int, mixed>
- Array of unique shared strings in workbook.
- $strTotal : int
- Total number of shared strings in workbook.
- $strUnique : int
- Number of unique shared strings in workbook.
- $summaryInformation : string
- Basic OLE object summary information.
- $two : int
- $useDiskCaching : bool
- Use disk caching where possible?
- $writerWorkbook : Workbook
- $writerWorksheets : array<string|int, Worksheet>
Methods
- __construct() : mixed
- Create a new Xls Writer.
- getDiskCachingDirectory() : string
- Get disk caching directory.
- 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.
- 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.
- getUseDiskCaching() : bool
- Get use disk caching where possible?
- openFileHandle() : void
- Open file handle.
- save() : void
- Save Spreadsheet 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.
- 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.
- setUseDiskCaching() : $this
- Set use disk caching where possible?
- maybeCloseFileHandle() : void
- Close file handle only if we opened it ourselves.
- processFlags() : void
- buildWorkbookEscher() : void
- Build the Escher object corresponding to the MSODRAWINGGROUP record.
- buildWorksheetEschers() : void
- Build the Worksheet Escher objects.
- checkForDrawings() : bool
- processBaseDrawing() : void
- processDrawing() : void
- processMemoryDrawing() : void
- writeDocumentSummaryInformation() : string
- Build the OLE Part for DocumentSummary Information.
- writeSummaryInformation() : string
- Build the OLE Part for Summary Information.
- writeSummaryProp() : void
- writeSummaryPropOle() : void
Properties
$fileHandle
protected
resource
$fileHandle
$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
$colors
Color cache. Mapping between RGB value and color index.
private
array<string|int, mixed>
$colors
$diskCachingDirectory
Disk caching directory.
private
string
$diskCachingDirectory
= './'
$documentSummaryInformation
Extended OLE object document summary information.
private
string
$documentSummaryInformation
$IDCLs
Identifier clusters for drawings. Used in MSODRAWINGGROUP record.
private
array<string|int, mixed>
$IDCLs
$parser
Formula parser.
private
Parser
$parser
$shouldCloseFile
private
bool
$shouldCloseFile
$spreadsheet
PhpSpreadsheet object.
private
Spreadsheet
$spreadsheet
$strTable
Array of unique shared strings in workbook.
private
array<string|int, mixed>
$strTable
= []
$strTotal
Total number of shared strings in workbook.
private
int
$strTotal
= 0
$strUnique
Number of unique shared strings in workbook.
private
int
$strUnique
= 0
$summaryInformation
Basic OLE object summary information.
private
string
$summaryInformation
$two
private
static int
$two
= 2
$useDiskCaching
Use disk caching where possible?
private
bool
$useDiskCaching
= false
$writerWorkbook
private
Workbook
$writerWorkbook
$writerWorksheets
private
array<string|int, Worksheet>
$writerWorksheets
Methods
__construct()
Create a new Xls Writer.
public
__construct(Spreadsheet $spreadsheet) : mixed
Parameters
- $spreadsheet : Spreadsheet
-
PhpSpreadsheet object
getDiskCachingDirectory()
Get disk caching directory.
public
getDiskCachingDirectory() : string
Return values
stringgetIncludeCharts()
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
boolgetPreCalculateFormulas()
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
boolgetUseDiskCaching()
Get use disk caching where possible?
public
getUseDiskCaching() : bool
Return values
boolopenFileHandle()
Open file handle.
public
openFileHandle(resource|string $filename) : void
Parameters
- $filename : resource|string
save()
Save Spreadsheet to file.
public
save(resource|string $filename[, int $flags = 0 ]) : void
Parameters
- $filename : resource|string
- $flags : int = 0
-
Flags that can change the behaviour of the Writer: self::SAVE_WITH_CHARTS Save any charts that are defined (if the Writer supports Charts) self::DISABLE_PRECALCULATE_FORMULAE Don't Precalculate formulae before saving the file
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
$thissetPreCalculateFormulas()
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
$thissetUseDiskCaching()
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
$thismaybeCloseFileHandle()
Close file handle only if we opened it ourselves.
protected
maybeCloseFileHandle() : void
processFlags()
protected
processFlags(int $flags) : void
Parameters
- $flags : int
buildWorkbookEscher()
Build the Escher object corresponding to the MSODRAWINGGROUP record.
private
buildWorkbookEscher() : void
buildWorksheetEschers()
Build the Worksheet Escher objects.
private
buildWorksheetEschers() : void
checkForDrawings()
private
checkForDrawings() : bool
Return values
boolprocessBaseDrawing()
private
processBaseDrawing(BstoreContainer &$bstoreContainer, BaseDrawing $drawing) : void
Parameters
- $bstoreContainer : BstoreContainer
- $drawing : BaseDrawing
processDrawing()
private
processDrawing(BstoreContainer &$bstoreContainer, Drawing $drawing) : void
Parameters
- $bstoreContainer : BstoreContainer
- $drawing : Drawing
processMemoryDrawing()
private
processMemoryDrawing(BstoreContainer &$bstoreContainer, MemoryDrawing $drawing, string $renderingFunctionx) : void
Parameters
- $bstoreContainer : BstoreContainer
- $drawing : MemoryDrawing
- $renderingFunctionx : string
writeDocumentSummaryInformation()
Build the OLE Part for DocumentSummary Information.
private
writeDocumentSummaryInformation() : string
Return values
stringwriteSummaryInformation()
Build the OLE Part for Summary Information.
private
writeSummaryInformation() : string
Return values
stringwriteSummaryProp()
private
writeSummaryProp(string $dataProp, int &$dataSection_NumProps, array<string|int, mixed> &$dataSection, int $sumdata, int $typdata) : void
Parameters
- $dataProp : string
- $dataSection_NumProps : int
- $dataSection : array<string|int, mixed>
- $sumdata : int
- $typdata : int
writeSummaryPropOle()
private
writeSummaryPropOle(float|int $dataProp, int &$dataSection_NumProps, array<string|int, mixed> &$dataSection, int $sumdata, int $typdata) : void
Parameters
- $dataProp : float|int
- $dataSection_NumProps : int
- $dataSection : array<string|int, mixed>
- $sumdata : int
- $typdata : int