I have the following Kartik GridView
echo GridView::widget([
'id' => 'resultsGrid',
'dataProvider' => $dataProvider,
'containerOptions' => [
'style' => 'height: 600px'
],
'showPageSummary' => true,
'condensed' => true,
'hover' => true,
'responsive' => true,
'bordered' => true,
'striped' => true,
'resizableColumns' => false, //Not full width table
'panel' => [
'type' => GridView::TYPE_INFO
],
'toolbar' => [
'{export}',
// '{toggleData}'
],
'floatHeader' => true,
'floatOverflowContainer' => true,
'pageSummaryRowOptions' => ['class' => 'kv-page-summary warning text-right'],
'columns' => $columnNames, //Comes from the Controller
]);
I’m having a problem with 1 column in particular because it hold variable data (time, text, …). When the first value is a Time value, when exported to Excel, Excel tries to format the column and remove the leading 0.
Now I’ve tried setting the columns format to text (actually tried all the formats) and nothing ever changes.
My question is: "is there a way to define the Gridview so that the column in question, when exported include a ’ which will force Excel to interpret it as text and not mess with it? (but I don’t want the ’ when displaying the column in the GridView itself, just on export to Excel)