kartik-v / yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)
http://demos.krajee.com/export
Other
165 stars 126 forks source link

Styles from property exportMenuHeaderStyle in kartik\grid\DataColumn are not applied for the header row of table when exporting to Excel 2007+ via ExportMenu widget. #285

Closed orioledev closed 5 years ago

orioledev commented 5 years ago

Prerequisites

Steps to reproduce the issue

  1. My code is:
    
    use kartik\export\ExportMenu;

$gridColumns = [ 'id', [ 'class' => \kartik\grid\DataColumn::class, 'attribute' => 'name', 'exportMenuHeaderStyle' => [ 'fill' => [ 'color' => ['argb' => \PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN], ], ], ], 'description', ]; ?>

<?= ExportMenu::widget([ 'dataProvider' => $dataProvider, 'columns' => $gridColumns, 'fontAwesome' => true, 'target' => ExportMenu::TARGET_SELF, 'showConfirmAlert' => false, 'clearBuffers' => true, 'initProvider' => true, 'headerStyleOptions' => [ ExportMenu::FORMAT_EXCEL_X => [ 'fill' => [ 'color' => ['argb' => \PhpOffice\PhpSpreadsheet\Style\Color::COLOR_YELLOW], ], ], ], ]);



2. Load the page with ExportMenu widget.

## Expected behavior and actual behavior

When I follow those steps, I see:

![2018-11-14_10-43-21](https://user-images.githubusercontent.com/6672987/48468681-9f4a7800-e7fd-11e8-8d9b-4409f92933d5.png)

I was expecting:

![2018-11-14_10-45-41](https://user-images.githubusercontent.com/6672987/48468691-a70a1c80-e7fd-11e8-8db8-fd7686e418ef.png)

I did not find the usages of exportMenuHeaderStyle for header cells in the generateHeader() method.
Also, in the generateBox() method common widget styles headerStyleOptions applied for all cells of header row.

## Environment

#### Browsers

- [x] Google Chrome
- [x] Mozilla Firefox
- [ ] Internet Explorer
- [ ] Safari

#### Operating System

- [x] Windows
- [ ] Mac OS X
- [x] Linux
- [ ] Mobile

#### Libraries

- jQuery version: v3.2.1
- yii2-export version: version 1.3.7

## Isolating the problem

- [ ] This bug happens [on the demos page](https://demos.krajee.com/export-demo)
- [x] The bug happens consistently across all tested browsers
- [x] This bug happens when using yii2-export without other plugins.
stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.