Reputation: 1349
I'm trying to apply custom css styles to exported files such as pdf.
For example how can applying custom css style in pdf export?
I changed some font styles in styleOptions
but nothing happen.
<?= ExportMenu::widget([
'target' => ExportMenu::TARGET_SELF,
'dataProvider' => $dataProvider,
'columns' => $report_columns,
'fontAwesome' => true,
'dropdownOptions' => [
'label' => Yii::t('app','Export All'),
'class' => 'btn btn-default'
],
'styleOptions' => [
'font' => [
'size' => '24px',
'bold' => true,
'color' => [
'argb' => 'FFFFFFFF',
],
],
'fill' => [
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => [
'argb' => '00000000',
],
],
],
'exportConfig' => [
ExportMenu::FORMAT_CSV => false,
ExportMenu::FORMAT_EXCEL => false,
ExportMenu::FORMAT_EXCEL_X => false,
ExportMenu::FORMAT_TEXT => false,
//ExportMenu::FORMAT_PDF => false,
//ExportMenu::FORMAT_HTML => false
]
]) . "<hr>\n".
GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => $columns,
'pjax' => true,
'summary' => '',
'options' => ['class' => 'xxx', 'style'=>'padding-right:10px']
]);
?>
Upvotes: 2
Views: 2131
Reputation: 43
The styleOptions must be setup as an associative array, as it was updated in the documentation for export menu styleOptions settings: http://demos.krajee.com/export#option-styleOptions
'styleOptions' => [
ExportMenu::FORMAT_EXCEL_X => [
'font' => [
'size' => '24px',
'bold' => true,
'color' => [
'argb' => 'FFFFFFFF',
],
],
'fill' => [
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => [
'argb' => '00000000',
],
],
],
],
And ensure you are importing PHPExcel_Style_Fill correctly.
Upvotes: 1