1. Go to this page and download the library: Download wisembly/excelant library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wisembly / excelant example snippets
use ExcelAnt\Adapter\PhpExcel\Workbook\Workbook,
ExcelAnt\Adapter\PhpExcel\Sheet\Sheet,
ExcelAnt\Adapter\PhpExcel\Writer\Writer,
ExcelAnt\Table\Table,
ExcelAnt\Coordinate\Coordinate;
Class Export
{
public function createExport(array $users)
{
$workbook = new Workbook();
$sheet = new Sheet($workbook);
$table = new Table();
foreach ($users as $user) {
$table->setRow([
$user->getName(),
$user->getEmail(),
]);
}
$sheet->addTable($table, new Coordinate(1, 1));
$workbook->addSheet($sheet);
}
}
use ExcelAnt\Adapter\PhpExcel\Writer\WriterFactory,
ExcelAnt\Adapter\PhpExcel\Writer\PhpExcelWriter\Excel5;
$writer = (new WriterFactory())->createWriter(new Excel5('/path/to/myExport.xls'));