antsugdev83 / simple-xlsx
There is no license information available for the latest version (1.0.0) of this package.
Simple create file xlsx
1.0.0
2025-02-11 16:13 UTC
Requires
- php: >=8.2
- ext-zip: *
- guzzlehttp/guzzle: ^7.9
- illuminate/config: ^11.41
- illuminate/container: ^11.41
- illuminate/filesystem: ^11.41
- league/flysystem: ^3.29
- nesbot/carbon: ^3.8
- phpoffice/phpspreadsheet: ^4.0
This package is auto-updated.
Last update: 2025-06-18 11:37:01 UTC
README
This project have scope simplify use plugin php spreadsheet.
This project create class for management creation file xlsx; into this class it's possible define:
- plus sheets
- header difference by number sheets
- possibility custom font color and background single colunm
- possibility custom define (if single sheet) define name single sheet
- possibility added before table, of information additional
- possibility create, after creation file xlsx, the zip
Use
Into directory example, they are found example code. In general, from user respect this sequence:
- instance class
$xlsx = new \Anton\SimpleXlsx\SimpleXlsx($header,'standard',null,1,null,$pathBase,null,null);
- instane headers and sheets
$row = $xlsx->setSpreadsheet();
This define initial base row.
- Read your data and call method for create body:
$xlsx->setBodyCell(0,0,$row,$item['name'],$color);
- Save file
$xlsx->save();
DETAILS OF ARGUMENTS FROM THE INSTANCE CLASS AND FROM THE PRINCIPAL FUNCTION INTO CLASS
INSTANCE
- header: array header file; this array it must be how example:
$headeres = [ [] ]
- title : name file
- sheets: array one-dimensional and value into this it must be string
- default row: this define where it begins table. Default is defined to 1; if greater one, table after the row defined
- extra data: this can to be string or array; if is defined and defaultRow greater one, into the file xlsx is positioned before table
- pathbase: is directory of save file
- len: if defined extradata this represents the columns length
- extracolor: array, represents the possibility change color font and background
FUNCTION
setSpreadsheet
This function create header and sheets.
The arguments are:
- background: you can to be null, if is defined represents color of background the columns from header
- color: you can to be null, if is defined represents color of font the columns from header
- name sheet: you can to be null, if is defined only sheet and represents name of sheet
setBodyCell
With this function is created column from the body.
The arguments are:
- index sheet
- index column (if zero example A0,B0,ec..)
- row
- data
- boolean value: if true define background column difference ('F2F3F4' or 'EAEDED')
- position text : left,center or rigth
- number format data: for this argument it is postponed NumberFormat
- fill: the possibility custom background color column and bold or not bold text; this is an array
save
This function create file. It's possible call this function with argument ZipArchive; if this is defined the function create zip with file xlsx.