I’m developing a web application to control the information of some energy groups. I’m using kartik GridView and ExportMenu. The problem is that I need to set the document’s title on the header to the exported Excel / Pdf exported file,
I’ve searched other posts but I can’t find anything specific.
You can use contentBefore to add some content (string) before the table starts on. Like:
'dataProvider' => $dataProvider,
'columns' => $searchModel->allGridColumns,
'fontAwesome' => false,
'target' => ExportMenu::TARGET_BLANK,
'deleteAfterSave' => true, // this will delete the saved web file after it is streamed to browser,
'filename' => 'municipios_Aris' . date('Y-m-d_H-i-s'),
'folder' => Yii::getAlias('@runtime'.'/export'),
'contentBefore' => [
['value' => 'YOUR TITLE'],
'dropdownOptions' => [
'label' => 'Exportar Para',
'class' => 'btn btn-default'
Remember that ‘contentBefore’ => [ [‘value’ => ‘YOUR TITLE’], … ] it’s a Array of Arrays, so every array inside the array ‘contentBefore’ will be a row added to your content before the table. Hope I helped you