Change Values Of Columns In Eexcelview

Hi All,

I am using an EExcelView extension to export data using Excel sheet and wanted to change the value for the columns. I have used other extensions for PDF and it easily allows me to change the value of the columns after passing data using the dataprovider.

Please do let me know if anyone has tried to do it before. In the below code, I would like to change the value for email at this level and many others which is similar to this.




$this->widget('ext.eexcelview.EExcelView', array(

            'id' => 'tool-grid',

            'dataProvider' => $dataProvider,

            'title' => 'Report',

            'filename' => 'file',

            'exportType' => 'Excel5',

            'autoWidth' => false,

            'stream' => TRUE, //make sure you output to browser

            'columns' => array(

                'id',

                'username',

                array(

                    'name' => 'email',

                    'value' => '<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />'

                ),

            )

        ));



Its simple like cgridview

so you can use it like this





array(

			'name' => 'duration_year',

			'header'=> 'Sem',

			'type' => 'raw',

			'value' => '$data->duration_year . "/" . $data->duration_sem',

			'htmlOptions'=>array('width'=>'122px')

		),



I hope it will help you

Hi Chandran,

Thanks a lot for your post. But I have tried using ‘value’ => ‘$data->duration_year . “/” . $data->duration_sem’, to get the value from the dataprovider and tweak it a bit but it doesnot seem to work incase of EExcelView. Definitely works fine with CGridView. Let me know if you have tried using it before. Thanks.

Error message I receive in above case:

Trying to get property of non-object [Error 500]

Hi,

Have u checked with $data->email ?

if yes … what output are you getting ?

Hi Chandran,




array(

'name' => 'email',

'value' => '$data->name. "/" . $data->email',

)



Definitely I have tried it and the error I am getting is : Trying to get property of non-object [Error 500]

Also similarly I have other data values which I want to modify but I can’t which is something like this below:




array(

'name' => 'status',

'value' => '($data->status=="0")?("Open")<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/sad.gif' class='bbc_emoticon' alt=':(' />($data->status=="1")?("Closed")<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/sad.gif' class='bbc_emoticon' alt=':(' />"Escalated"))',

)



Anyway these are just set of examples I have tried, but none of that work.