transform
transform


Transforms spreadsheets into other formats (XLSX, PDF, XLS, ODS).
Description
public transform($source, $target, $method = null, $options = array())
This method allows to transform a spreadsheet, generated or not with phpxlsx, into PDF, XLSX, XLS and ODS preserving, as much as possible, the original formatting options.
You may find more info regarding this method in the Conversion plugin section.
Parameters
source
Path to the spreadsheet that you want to convert to a different format.
target
Path to the resulting transformed spreadsheet (PDF, XLSX, XLS or ODS).
method
Method used to transform the spreadsheet: 'libreoffice', 'msexcel'
'libreoffice' method options
The possible keys and values are:
Key | Type | Description |
---|---|---|
debug | bool | Returns debug information about the conversion plugin. Default as false |
escapeshellarg | bool | Applies escapeshellarg to escape source and LibreOffice path strings. Default as false |
extraOptions | string | Extra parameters to be used when doing the conversion. |
homeFolder | string | Sets a custom home folder to be used for the conversions. |
outdir | string | Sets the outdir path. Useful when the output path is not the same than the running script. |
path | string | Sets the LibreOffice path. This option can be used instead of the path option in config/phpxlsxconfig.ini. |
recalcFunctions | bool | Recalcs functions when transforming to PDF. Default as false. Check the macros-libreoffice folder included in Advanced and Premium packages to use this option. |
Exceptions
Method not available.
Release notes
- phpxlsx 4.5:
- added "--norestore" to all conversions in the LibreOffice conversion plugin.
- new documentation in the macros-libreoffice folder to enable and use lossless compression without adding a macro.
- path and escapeshellarg options.
- phpxlsx 3.5:
- recalcFunctions option.
- phpxlsx 1.0:
- new method.