[EXTENSION]eexcelview

Great extension but I can’t get it working with relations.

Trying to get property of non-object

$value=$this->evaluateExpression($column->value ,array(‘data’=>$data[$row]));

Could someone advise me how to deal with such issue?

How about documenting this extension? It would make life a lot easier and not leave people wasting their time.

cGridView has filters, so how do we use this extension while taking advantage of filters? For example, I have a gridview and one of the columns is "Country", with a drop menu in the filters. If I select a country, how do I export the result using this extension?

Do you know if there is a way to get the grid view to look better for the PDF output of the plugin.

This is my code:

PS The Title doesn’t show up on the PDF either.


<?php

 $bUrl=Yii::app()->baseUrl;

$this->widget('application.extensions.EExcelView', array(

	'id'=>'pms-grid',

	'autoWidth'=>false,

	'dataProvider'=>$model->search(),

	'title'=>'Preventative Maintenance History',

	'exportType'=>'PDF',

	'columns'=>array(

		'id',

		'asset_id',

		'type_of_maintenance',

		'scheduled_maintenance:boolean',

		'unscheduled_maintenance:boolean',

		'schduled_date',)

       

));

?>

I found this patch on the website to fix thick borders, a lot better not perfect but fixes a border 0 bug:


# This patch file was generated by NetBeans IDE

# Following Index: paths are relative to: /home/matthias/NetBeansProjects/Flotilla/code/classes/objects/PHPExcel/Writer

# This patch can be applied using context Tools: Patch action on respective folder.

# It uses platform neutral UTF-8 encoding and \n newlines.

# Above lines and this line are ignored by the patching process.

Index: HTML.php

--- HTML.php Base (BASE)

+++ HTML.php Locally Modified (Based On LOCAL)

@@ -222,7 +222,7 @@

 	 */

 	private function _mapBorderStyle($borderStyle) {

 		switch ($borderStyle) {

-			case PHPExcel_Style_Border::BORDER_NONE:				return '0px';

+			case PHPExcel_Style_Border::BORDER_NONE:				return '1px hidden';

 			case PHPExcel_Style_Border::BORDER_DASHDOT:				return '1px dashed';

 			case PHPExcel_Style_Border::BORDER_DASHDOTDOT:			return '1px dotted';

 			case PHPExcel_Style_Border::BORDER_DASHED:				return '1px dashed';



Attached is the corrected file:

Replace /protected/extensions/PHPExcel/Writer/

I have a problem with ‘disablePaging’.




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

	'dataProvider' => $dataProvider,

	'disablePaging' => true,

));



Pagination is not disabled.

Tell me, what could be the case.

put in the call at CActiveDataProvider the parameter pagination

[b]

[/b]

in your code





   $dataProvider  =   new CActiveDataProvider($model,array('pagination'=>false)),


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

	'dataProvider' => $dataProvider,

    //'disablePaging' => true, //not here

));



you can see an example in http://www.yiiframework.com/forum/index.php?/topic/18119-extensioneexcelview/page__view__findpost__p__101015

For anyone with this error - the reason is that PHPExcel is not in the correct folder. It is currently hardcoded to ‘application.extensions.phpexcel.Classes.PHPExcel’.


.............

//Autoload fix

spl_autoload_unregister(array('YiiBase','autoload'));             

Yii::import('application.extensions.phpexcel.Classes.PHPExcel', true);

$this->objPHPExcel = new PHPExcel();

spl_autoload_register(array('YiiBase','autoload'));

...............

What happens is this:

[list=1]

[*]Yii’s autoload is unregistered.

[*]The widget’s tries to load the PHPExcel class

[*]It doesnt find the class, so try to throw CException

[*]Cannot find CException because autoloader is unregistered

[/list]

I will add check in the new version, i’ve just been really busy lately. :rolleyes:

Dear author,

Is extension supposed to work with relational fields? I saw some message about path but still unlucky to make it working (

Yes, it is :) What’s the problem, give us some code. It extends gridview, if you see it in the grid you shuold be eable to export.

Hi guys

eexcelview extension suppose put in controller side, right??




1.$this->widget('EExcelView', array(

     'dataProvider'=> $dataprovider,

     'title'=>'Title',

     'autoWidth'=>false,

));


2.$this->widget('application.extensions.eexcelview.EExcelView', array(

        'dataProvider' => $dataProvider,

));

which one at above is the correct one??

The link at menu panel is to allow user click and render to excel action and save the excel file??

$this->menu=array(

    array('label'=&gt;'List', 'url'=&gt;array('index')),


    array('label'=&gt;'Crete', 'url'=&gt;array('create')),


    array('label'=&gt;'Export to Excel', 'url'=&gt;array('excel',


                                                'title'=&gt;'Cantones',


                                                'model'=&gt;'Canton',


                                                'items'=&gt;&#036;serialized,))

);

I’m dealing with a very strange issue. I created multiple excel data exports in my application. At my local develop machine all exports working great. But at my live site most exports are working but some not. I get the following error: ERR_FILE_NOT_FOUND.

This is weird because the exports are very basic and the same as those which are working great.

All exports are including the ones failing at my live server build the same way (except attributes), like this:




<?php

$data=new CActiveDataProvider('User');

$this->widget('EExcelView', array(

     'dataProvider'=> $data,

     'title'=>'Users',

     'autoWidth'=>true,

     'columns'=>array(

		'name',

		'lastname',

		'address',		

	 ),		

    ));

?>



Anyone idea why I’m having this issue?

Anyone know how I can force the excel datatype for columns? (for example, force the column to be text instead of numerical) And color cells/columns?

Thanks!

hi did some modification to extension

Added footer and relationships to eexcelview

http://francisja.tumblr.com/post/18486330299/extended-eexcelview-with-relational-database-and-footer

I made some modification over your existing code, many thanks.

Mainly i fixed some minor bugs and made performance improvements over the original code. Also I added support for passing the PHPExcel path as a param.

Download 2677

EExcelView.php

Besides,

I created a wrapper for this extension, so you could easily deploy it and use it with many sets of data: you’ll find it here: http://www.yiiframework.com/extension/toexcel/

Hope it helps, and many greet to all :)

Hi! I’m trying to use your extension. It seems that ‘disablePaging’ doesn’t really work. I tried to set it true or false and I always get only the results from the first page (30 results from the pagination).

Do you have any idea why doesn’t work?

Another question is …when i set the type as csv I still get the first 30 rows and then there is a html code combined with Sql code and i don’t get it.

I need help :)

Thanks,

Hi, for the first question, the option for disabling paging doesn’t work, you neet to set it manually on your CActiveDataProvider.

For the second options, i suspect you have an error in your query or you are trying to access data that dont exist in your data set (null pointers), so yii brings up and error and so it prints html and sql (error code). Try looping and echo’ing to screen your data set in order to check this error.

Greets :)

@Jeroendh - did you solve this? I’m trying to do the same

I tried many workarounds for this issue and I came up with a cheap trick.

First, create a getter in your model for the numeric attribute you want to export as text




<?php

public getTextID()

{

  return '&nbsp;' . $this->id;

}



And in the widget in the columns array




...

'columns'=>array(

  'textID:html:ID',

  ...

)



Hope it helps :)

PD: You cant create your own CFormatter, so you can simply put ‘id:yourFormatter’ instead of defining a getter and all. I thinks that would work too, didn’t try it, thou.

how can i convert both CDetailview and Cgridview (or particular <div> element as like printing using Mprint extension) on same page to pdf and excelview.that is i need to get the invoice to export in pdf pls help in this

I had some error during PHPExcel import:

Yii::import(‘application.extensions.phpexcel.Classes.PHPExcel’, true);

and as result had next message (because autoload was reset to PHPExcel autoload function):

Fatal error: Class ‘CExceptionEvent’ not found in C:\Projects\.libs\yii-framework-1_1_10\base\CApplication.php on line 707

And next fix will help to show Yii exception page if some error occurred during PHPExcel importing:


spl_autoload_unregister(array('YiiBase','autoload'));    

try {

	Yii::import('application.extensions.phpexcel.Classes.PHPExcel', true);

}

catch (Exception $e) {

	spl_autoload_register(array('YiiBase','autoload'));

	throw  $e;

}

$this->objPHPExcel = new PHPExcel();

spl_autoload_register(array('YiiBase','autoload'));

Hope this help to someone else.