phpxlsx provides the necessary methods to modify the layout and settings of the spreadsheet (workbook, sheets, columns and rows), as well as set the internal properties such as author, description and keywords.
Each spreadsheet has internal properties such as subject, creator, description or categories. Besides, it counts with full-customizable properties in its name and value.
phpxlsx includes addProperties to define the properties:
$values is an array of the properties to add. Besides its predefined properties like subject or creator, the custom key allows to add new properties.
For example, for inserting multiple properties in the spreadsheet, use the code:
The method for applying workbook settings is setWorkbookSettings:
$options is an array which can have these keys:
- 'activeTab': sets the active tab in the workbook
- 'activeSheetAsActiveTab': if true, sets the internal active sheet as the active tab
The following sample code sets the internal active sheet as the active tab:
A fixed value can also be set as the active tab:
The method for applying sheet settings is setSheetSettings:
$options is an array to set sheet margins, paper properties, the orientation, the active cell and other settings in the active sheet.
The following sample code changes the settings of the active sheet:
Column and row settings can be changed using setColumnSettings and setRowSettings methods:
The $position parameter sets the column or row position to be changed. The $options array allows applying the settings.
Let's set column and row sizes:
The setRtl method sets global right to left options.