You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Yii2 Excel Export
16
16
* Create excel files with multiple sheets
17
17
* Format cells and values
18
18
19
-
To write the Excel file, we use the excellent [PHPExcel](https://github.com/PHPOffice/PHPExcel) package.
19
+
To write the Excel file, we use the excellent [PHPSpreadsheet](https://github.com/PHPOffice/PhpSpreadsheet) package.
20
20
21
21
## Installation
22
22
@@ -49,7 +49,7 @@ Find more examples below.
49
49
50
50
Property | Description
51
51
---------|-------------
52
-
`writerClass` | The file format as supported by PHPOffice. The default is `\PHPExcel_Writer_Excel2007`
52
+
`writerClass` | The file format as supported by PHPOffice. The default is `\PhpOffice\PhpSpreadsheet\Writer\Xlsx`
53
53
`sheets` | An array of sheet configurations (see below). The keys are used as sheet names.
54
54
`fileOptions` | Options to pass to the constructor of `mikehaertl\tmp\File`. Available keys are `prefix`, `suffix` and `directory`.
55
55
@@ -58,8 +58,8 @@ Methods | Description
58
58
`saveAs($name)` | Saves the excel file under `$name`
59
59
`send($name=null, $inline=false, $contentType = 'application/vnd.ms-excel')` | Sends the excel file to the browser. If `$name` is empty, the file is streamed for inline display, otherwhise a download dialog will open, unless `$inline` is `true` which will force inline display even if a filename is supplied.
60
60
`createSheets()` | Only creates the sheets of the excel workbook but does not save the file. This is usually called implicitely on `saveAs()` and `send()` but can also be called manually to modify the sheets before saving.
61
-
`getWriter()` | Returns the `PHPExcel_Writer_Abstract` instance
62
-
`getWorkbook()` | Returns the `PHPExcel` workbook instance
61
+
`getWriter()` | Returns the `\PhpOffice\PhpSpreadsheet\Writer\BaseWrite` instance
62
+
`getWorkbook()` | Returns the `\PhpOffice\PhpSpreadsheet\Spreadsheet` workbook instance
63
63
`getTmpFile()` | Returns the `mikehaertl\tmp\File` instance of the temporary file
64
64
65
65
### ExcelSheet
@@ -68,11 +68,11 @@ Property | Description
68
68
---------|-------------
69
69
`data` | An array of data rows that should be used as sheet content
70
70
`titles` (optional) | An array of column titles
71
-
`types` (optional) | An array of types for specific columns as supported by PHPOffice, e.g. `\PHPExcel_Cell_DataType::TYPE_STRING`, indexed either by column name (e.g. `H`) or 0-based column index.
71
+
`types` (optional) | An array of types for specific columns as supported by PHPOffice, e.g. `DataType::TYPE_STRING`, indexed either by column name (e.g. `H`) or 0-based column index.
72
72
`formats` (optional) | An array of format strings for specific columns as supported by Excel, e.g. `#,##0.00`, indexed either by column name (e.g. `H`) or 0-based column index.
73
73
`formatters` (optional) | An array of value formatters for specific columns. Each must be a valid PHP callable whith the signature `function formatter($value, $row, $data)` where `$value` is the cell value to format, `$row` is the 0-based row index and `$data` is the current row data from the `data` configuration. The callbacks must be indexed either by column name (e.g. `H`) or by the 0-based column index.
74
74
`styles` (optional) | An array of style configuration indexed by cell coordinates or a range.
75
-
`callbacks` (optional) | An array of callbacks indexed by column that should be called after rendering a cell, e.g. to apply further complex styling. Each must be a valid PHP callable with the signature `function callback($cell, $col, $row)` where `$cell` is the current `PHPExcel_Cell` object and `$col` and `$row` are the 0-based column and row indices respectively.
75
+
`callbacks` (optional) | An array of callbacks indexed by column that should be called after rendering a cell, e.g. to apply further complex styling. Each must be a valid PHP callable with the signature `function callback($cell, $col, $row)` where `$cell` is the current `PhpOffice\PhpSpreadsheet\Cell\Cell` object and `$col` and `$row` are the 0-based column and row indices respectively.
76
76
`startColumn` (optional) | The start column name or its 0-based index. When this is set, the 0-based offset is added to all numeric keys used anywhere in this class. Columns referenced by name will stay unchanged. Default is 'A'.
77
77
`startRow` (optional) | The start row. Default is 1.
78
78
@@ -116,7 +116,7 @@ Property | Description
116
116
$file = \Yii::createObject([
117
117
'class' => 'codemix\excelexport\ExcelFile',
118
118
119
-
'writerClass' => '\PHPExcel_Writer_Excel5', // Override default of `\PHPExcel_Writer_Excel2007`
119
+
'writerClass' => '\PhpOffice\PhpSpreadsheet\Writer\Xls', // Override default of `\PhpOffice\PhpSpreadsheet\Writer\Xlsx`
120
120
121
121
'sheets' => [
122
122
@@ -177,7 +177,7 @@ $file = \Yii::createObject([
177
177
'formatters' => [
178
178
// Dates and datetimes must be converted to Excel format
0 commit comments