custom-it/yii2-excel-report

An extension for generate excel file from GridView content

Installs: 1 805

Dependents: 0

Suggesters: 0

Security: 0

Stars: 38

Watchers: 10

Forks: 14

Type:yii2-extension

1.0.1 2018-08-10 09:11 UTC

This package is not auto-updated.

Last update: 2024-11-14 18:24:39 UTC


README

- !!! Library is deprecated !!!

Yii2 ExcelReport Extension


An extension for generate excel file from GridView content. When used with a GridView, extention saves the results of filtering and sorting in a file. Everything you see in the GridView will be imported into a file. All tasks are run in the background, the user can check the progress with the progressbar. It is not necessary to remain on the current page during the execution. You can continue working with the application. When the file is created, the download link will remain on the page with the widget until it is used, the user can use it at any time. When the file is downloaded, you can start generating a new report.

To run tasks in the background, the extension uses a queues.

Use the extension only makes sense to generate large files (> 50,000 lines).

Latest Stable Version Total Downloads

Installation

The preferred way to install this extension is through composer.

Either run

php composer require --prefer-dist custom-it/yii2-excel-report

or add

"custom-it/yii2-excel-report": "*"

to the require section of your composer.json file.

Configuration

Before using the module, configure the queues

Add progress behavior to Queue configuration:

'queue' => [
    // ... you Queue configuration ...
    'as progress' => \customit\excelreport\ProgressBehavior::class,
],

Usage

Once the extension is installed, simply use it in your code by :

$gridColumns = [
    ['class' => 'yii\grid\SerialColumn'],
    'id',
    'name',
    'date',
    'post',
    ['class' => 'yii\grid\ActionColumn'],
];

// Render widget
echo \customit\excelreport\ExcelReport::widget([
    'columns' => $gridColumns,
    'dataProvider' => $dataProvider,
]);

// Can be used with or without a GridView
echo GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => $gridColumns
]);