gpt4 book ai didi

excel - 如何在 Yii2 krajee 网格导出中更改导出表/文档属性?

转载 作者:行者123 更新时间:2023-12-04 20:06:00 26 4
gpt4 key购买 nike

我们已经使用 yii2 krajee export 导出网格数据。我们如何修改默认标题、描述、lastmodifiedby?

echo ExportMenu::widget([
'dataProvider' => $dataProvider,
'columns' => $gridColumns,
'target' => ExportMenu::TARGET_SELF,
'exportConfig' => [
ExportMenu::FORMAT_PDF => false,
],
'filename' => 'export-list_' . date('Y-m-d_H-i-s'),
]);

最佳答案

我做了什么来完成我的任务-
我的标题中有-

use yii\helpers\Html;
use kartik\grid\GridView;

然后在gridView -
    <?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'pjax'=>true,
'id' => 'grid',
'toolbar' => [
['content'=>
Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['ctrl-action'], ['data-pjax'=>false, 'class' => 'btn btn-default', 'title'=>'Reset Grid'])
],
'{export}',
'{toggleData}'
],
'panel' => [
'heading'=>'<h3 class="panel-title"><i class="glyphicon glyphicon-cloud"></i> Output Daily Data </h3>',
'type'=>'primary',
'before'=>Html::a(''),
'after'=>Html::a(''),
'showFooter'=>false
],
'columns' => [
['class' => 'kartik\grid\SerialColumn'],

'id',
'name'
['class' => 'yii\grid\ActionColumn'],
],

'responsive'=>true,
'hover'=>true,
'exportConfig' => [
GridView::CSV => ['label' => 'Export as CSV', 'filename' => 'File_Name-'.date('d-M-Y')],
GridView::HTML => ['label' => 'Export as HTML', 'filename' => 'File_Name -'.date('d-M-Y')],
GridView::PDF => ['label' => 'Export as PDF', 'filename' => 'File_Name -'.date('d-M-Y')],
GridView::EXCEL=> ['label' => 'Export as EXCEL', 'filename' => 'File_Name -'.date('d-M-Y')],
GridView::TEXT=> ['label' => 'Export as TEXT', 'filename' => 'File_Name -'.date('d-M-Y')],
],
'export' => [
'fontAwesome' => true
],
]); ?>

这对我有用。
只需在 'exportConfig' 中进行更改重命名文件的部分。

关于excel - 如何在 Yii2 krajee 网格导出中更改导出表/文档属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37697593/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com