Excel
class Excel (View source)
Class Excel
Constants
TYPE_STRING |
|
TYPE_INT |
|
TYPE_DOUBLE |
|
TYPE_TIMESTAMP |
|
SKIP_NONE |
|
SKIP_EMPTY_ROW |
|
SKIP_EMPTY_CELLS |
|
GRIDLINES_HIDE_ALL |
|
GRIDLINES_SHOW_SCREEN |
|
GRIDLINES_SHOW_PRINT |
|
GRIDLINES_SHOW_ALL |
|
Methods
Excel constructor.
Const memory model
Checkout worksheet
Generate file
Get file resource
Auto filter on the worksheet
Insert data on the cell
Insert date on the cell
Insert chart on the cell
Insert url on the cell
Insert image on the cell
Insert Formula on the cell
Merge cells
Set column cells width or format
Set row cells height or format
Read values from the sheet
Read values from the sheet
Next Cell In Callback
Freeze panes
Details
__construct(array $config)
Excel constructor.
Excel
fileName(string $fileName, string $sheetName = 'Sheet1')
File Name
Excel
constMemory(string $fileName, string $sheetName = 'Sheet1')
Const memory model
Excel
addSheet(string|null $sheetName)
Add a new worksheet to a workbook.
The worksheet name must be a valid Excel worksheet name, i.e. it must be less than 32 character and it cannot contain any of the characters:
/ \ [ ] : * ?
In addition, you cannot use the same, case insensitive, $sheetName
for more
than one worksheet.
Excel
checkoutSheet(string $sheetName)
Checkout worksheet
Excel
header(array $header)
Insert data on the first line of the worksheet
Excel
data(array $data)
Insert data on the worksheet
string
output()
Generate file
resource
getHandle()
Get file resource
Excel
autoFilter(string $range)
Auto filter on the worksheet
Excel
insertText(int $row, int $column, int|string|float $data, string $format = null, resource|null $formatHandle = null)
Insert data on the cell
Excel
insertDate(int $row, int $column, int $timestamp, string $format = null, resource|null $formatHandle = null)
Insert date on the cell
Excel
insertChart(int $row, int $column, resource $chartResource)
Insert chart on the cell
Excel
insertUrl(int $row, int $column, string $url, resource|null $formatHandle = null)
Insert url on the cell
Excel
insertImage(int $row, int $column, string $imagePath, float $width = 1, float $height = 1)
Insert image on the cell
Excel
insertFormula(int $row, int $column, string $formula)
Insert Formula on the cell
Excel
MergeCells(string $range, string $data)
Merge cells
Excel
setColumn(string $range, float $cellWidth, resource|null $formatHandle = null)
Set column cells width or format
Excel
setRow(string $range, float $cellHeight, resource|null $formatHandle = null)
Set row cells height or format
Excel
openFile(string $fileName)
Open xlsx file
Excel
openSheet(string $sheetName = null, int $skipFlag = 0x0)
Open sheet
default open first sheet
Excel
setType(array $types)
Set row cell data type
array
getSheetData()
Read values from the sheet
array
nextRow()
Read values from the sheet
void
nextCellCallback(callable $callback, string $sheetName = null)
Next Cell In Callback
Excel
freezePanes(int $row, int $column)
Freeze panes
freezePanes(1, 0); // Freeze the first row. freezePanes(0, 1); // Freeze the first column. freezePanes(1, 1); // Freeze first row/column.
Excel
gridline(int $option)
Gridline
Display or hide screen and print gridlines using one of the values of
\Vtiful\Kernel\Excel::GRIDLINES_HIDE_ALL \Vtiful\Kernel\Excel::GRIDLINES_SHOW_ALL \Vtiful\Kernel\Excel::GRIDLINES_SHOW_PRINT \Vtiful\Kernel\Excel::GRIDLINES_SHOW_SCREEN
Excel default is that the screen gridlines are on and the printed worksheet is off.
Excel
zoom(int $scale)
Worksheet zoom
Set the worksheet zoom factor in the range 10 <= zoom <= 400: