Gridview Yii2,用于Kartik导出的自定义css样式
我正在尝试将自定义css样式应用于导出的文件,如pdf 例如,如何在pdf导出中应用自定义css样式 我在Gridview Yii2,用于Kartik导出的自定义css样式,gridview,yii2,kartik-v,Gridview,Yii2,Kartik V,我正在尝试将自定义css样式应用于导出的文件,如pdf 例如,如何在pdf导出中应用自定义css样式 我在styleOptions中更改了一些字体样式,但什么也没发生 <?= ExportMenu::widget([ 'target' => ExportMenu::TARGET_SELF, 'dataProvider' => $dataProvider, 'columns' => $report_column
styleOptions
中更改了一些字体样式,但什么也没发生
<?= 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']
]);
?>
样式选项必须设置为关联数组,因为它已在导出菜单样式选项设置的文档中更新:
并确保正确导入PHPExcel\u-Style\u-Fill。如何正确导入
PHPExcel\u-Style\u-Fill
?请举个例子。
'styleOptions' => [
ExportMenu::FORMAT_EXCEL_X => [
'font' => [
'size' => '24px',
'bold' => true,
'color' => [
'argb' => 'FFFFFFFF',
],
],
'fill' => [
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => [
'argb' => '00000000',
],
],
],
],