Search by

stolentine / excel

stolentine

There is no license information available for the latest version (v1.0.0) of this package.

This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.

v1.0.0 2021-07-07 08:29 UTC

This package is auto-updated.

Last update: 2022-10-07 12:40:47 UTC


README

Пакет-прослойка для работы с файлами EXCEL.

Позволяет абстрагироваться от конкретных реализаций библиотек.

Пример создания экспорта.

use Stolentine\Excel\Export\IExcelExport;
use Stolentine\Excel\Table;

class ExportController extends \Illuminate\Routing\Controller {
    
    public function export(IExcelExport $excelExport){
        // любые данные
        $data = [
            ['foo0', 'baz0', 'bar0'],
            ['foo1', 'baz1', 'bar1'],
            ['foo2', 'baz2', 'bar2'],
        ];
        
        // заголовки колонок
        $headings = [
            'FooHeader',
            'BazHeader',
            'BarHeader',
        ];
        
        // скачивание файла. В конце файл удалится.
        return $excelExport->setTable(
            new Table($data, $headings)
        )->setFileName('examplName.csv');
    }
}

Содержание файла:

"FooHeader","BazHeader","BarHeader"
"foo0","baz0","bar0"
"foo1","baz1","bar1"
"foo2","baz2","bar2"

####Todo

  • добавить тип возвращаемого значения
  • сохранение файла в файловой системе
  • установку заголовков