Yii Framework Forum: [EXTENSION]eexcelview - Yii Framework Forum

Jump to content

  • (6 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION]eexcelview http://www.yiiframework.com/extension/eexcelview/ Rate Topic: ***** 1 Votes

#41 User is offline   phreak 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 19-February 09

Posted 11 April 2012 - 12:43 AM

Just released a new ver with many improvements. Enjoy ! :)
0

#42 User is offline   dragonka 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 15-October 11

Posted 11 April 2012 - 06:57 AM

I think you should look at the 'param' property from dataProvider when rendering export buttons.
0

#43 User is offline   phreak 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 19-February 09

Posted 14 April 2012 - 04:37 AM

View Postdragonka, on 11 April 2012 - 06:57 AM, said:

I think you should look at the 'param' property from dataProvider when rendering export buttons.

I don't understand. Why should I look at the 'param' property of the dataProvider ?
0

#44 User is offline   dragonka 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 15-October 11

Posted 16 April 2012 - 08:09 AM

My english is rather bad so...

Above my gridView I have two date inputs and Find button. I select time range and push Find. Page reloads, and in my gridView I can see records between date_from and date_to. But when I try to export this records, page reload again and what I set in date_from and date_to is lost.

And I find another bug:

'columns'=>array(
post.number,
...


doesn't work
but

'columns'=>array(
array(
   'name'=>'post.number',
   'value'=>'$data->post->number',
...


works.
0

#45 User is offline   Jarzmann 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 09-November 11

Posted 17 April 2012 - 10:31 AM

View PostPreacher, on 09 October 2011 - 11:21 PM, said:

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',)
       
));
?>



Cant find the attached file. Morever, Writer is a folder not a file, so can u kindly point me to where to update?
0

#46 User is offline   ValeryM 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 28-June 11

Posted 25 April 2012 - 04:10 PM

to solve an problem with some data who's start with / are similar to a numeric value, i modify the code into the method renderRow:

if ($column->type != 'ftext') {
	$value=$value===null ? "" : $column->grid->getFormatter()->format($value,$column->type);
	$this->objPHPExcel->getActiveSheet()->setCellValue($this->columnName($a).($row+2) ,$value);
} else {
	$value = $value===null ? "" : $column->grid->getFormatter()->format($value,'text');
		$this->objPHPExcel->getActiveSheet()->getCell($this->columnName($a).($row+2))->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING);
}


You can use it by specify the type with the column property : 'type'=>'ftext'

Also, into the xls file you have the value 00012345 and not 12345.
0

#47 User is offline   banamlehsb 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 02-September 11

Posted 14 June 2012 - 06:05 AM

how can i add header and footer of excel sheet such as: name of report, date, company name, signature, company logo, summary ...
I attached an example.
help me, please.

Attached File(s)

  • Attached File  excel.PNG (55.06K)
    Number of downloads: 50

0

#48 User is offline   banamlehsb 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 02-September 11

Posted 18 June 2012 - 09:39 AM

View Postbanamlehsb, on 14 June 2012 - 06:05 AM, said:

how can i add header and footer of excel sheet such as: name of report, date, company name, signature, company logo, summary ...
I attached an example.
help me, please.


anyone help me???
0

#49 User is offline   A.Miguel 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 12-October 11

Posted 29 June 2012 - 09:33 AM

Hello,

I am trying to use this extension without success. Actually I am getting the contents printed in the web page rather than exported to the output stream.


Controller
   public function actionExport2excel() {

      $model = new GeneralProcess();
            
      $this->widget('application.extensions.EExcelView.EExcelView' , array(
                        'dataProvider' =>  new CActiveDataProvider ($model , array('pagination'=>false)),
                        'title'=>"Some title",
                        'exportType'=>'Excel2007',
                        'columns'=>array('id','court_process'),
      ));
      Yii::app()->end();
   } 



View
$this->menu=array(
	array('label'=>'Create Process','url'=>array('create')),
        array('label'=>'Export To Excel','url'=>array('export2excel')),
);


When I click on "Export to Excel" link I will be redirected to the export2excel action and the contents of dataProvider (columns 'id' and 'court_process') are written on the screen.

Am I doing something wrong?



Thanks for the help
A.Miguel
0

#50 User is offline   phreak 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 19-February 09

Posted 29 June 2012 - 01:51 PM

@A.Miguel try to add this property
....
'grid_mode'=>'export',
.....

@banamlehsb: that's not possible at the moment. May I can think of some callback function to render the header and footer. Or may be I can return the excel object so you can add anything with your own code.
0

#51 User is offline   A.Miguel 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 12-October 11

Posted 29 June 2012 - 08:14 PM

View Postphreak, on 29 June 2012 - 01:51 PM, said:

@A.Miguel try to add this property
....
'grid_mode'=>'export',
.....


Yeah, I found it while debugging your code! ;)

Thanks for the quick reply anyway!

A.Miguel
0

#52 User is offline   heyhey 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 20-July 12

Posted 20 July 2012 - 08:41 PM

Can i past in an array of values and columns and it displays the excel spreadsheet
0

#53 User is offline   Nikolay Yanev 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 23-July 12

Posted 23 July 2012 - 02:17 AM

Hello,

Can I format output of the excel file? I want to bold the header row and change the font of the table.
0

#54 User is offline   phreak 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 19-February 09

Posted 23 July 2012 - 07:04 AM

View Postheyhey, on 20 July 2012 - 08:41 PM, said:

Can i past in an array of values and columns and it displays the excel spreadsheet

Why dont you just pass this to CArrayDataProvider and use it as a datasource ?
0

#55 User is offline   phreak 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 19-February 09

Posted 23 July 2012 - 07:09 AM

View PostNikolay Yanev, on 23 July 2012 - 02:17 AM, said:

Hello,

Can I format output of the excel file? I want to bold the header row and change the font of the table.


Well formatting excel tables might be quite specific to any user/project. So I've created callback functions when rendering headers and rows. So you can create a callback function for onRenderHeaderCell(PHPExcel_Cell $cell, string $value) and use the $cell to do whatever you want, see PHPExcel's documentation for more info.
0

#56 User is offline   Nikolay Yanev 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 23-July 12

Posted 24 July 2012 - 02:18 AM

View Postphreak, on 23 July 2012 - 07:09 AM, said:

Well formatting excel tables might be quite specific to any user/project. So I've created callback functions when rendering headers and rows. So you can create a callback function for onRenderHeaderCell(PHPExcel_Cell $cell, string $value) and use the $cell to do whatever you want, see PHPExcel's documentation for more info.


Where should I place this code?
0

#57 User is offline   phreak 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 19-February 09

Posted 26 July 2012 - 08:08 AM

View PostNikolay Yanev, on 24 July 2012 - 02:18 AM, said:

Where should I place this code?


You create of function in you controller onRenderHeaderCell(PHPExcel_Cell $cell, string $value) then when you init the widget , you do it like this:

$this->widget(.....
'onRenderHeaderCell'=>array($this, 'onRenderHeaderCell'),
....);
0

#58 User is offline   yJeroen 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 94
  • Joined: 06-September 11
  • Location:The Netherlands

Posted 27 July 2012 - 11:34 AM

View Postrussellfeeed, on 26 March 2012 - 10:29 AM, said:

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


I did some ugly hacking in the EExcelView::renderRow() method. Not very nice but it suited my need for that time.

public function renderRow($row)
{
	$data=$this->dataProvider->getData();			
	
	if(!$this->showHeader) $offset = 1;
	else $offset = 0;
	
	$a=0;
	foreach($this->columns as $n=>$column)
	{
	    if($column->value!==null) 
	        $value=$this->evaluateExpression($column->value ,array('data'=>$data[$row]));
	    else if($column->name!==null) 
	        $value=$data[$row][$column->name];

	    $value=$value===null ? "" : $column->grid->getFormatter()->format($value,$column->type);
	    
		$a++;
		if($column->type=='text')
			$this->objPHPExcel->getActiveSheet()->setCellValueExplicit($this->columnName($a).($row+2-$offset), $value, PHPExcel_Cell_DataType::TYPE_STRING);
		else
			$this->objPHPExcel->getActiveSheet()->setCellValue($this->columnName($a).($row+2-$offset), $value);
		
		if(substr($value,'\n'))
			$this->objPHPExcel->getActiveSheet()->getStyle($this->columnName($a).($row+2-$offset))->getAlignment()->setWrapText(true);
		
		if(isset($column->cssClassExpression))
		{
			$css = $this->evaluateExpression($column->cssClassExpression,array('data'=>$data[$row]));
			if($css=='red')
			{
				$background = 'FF0000';
				$font = 'FFFFFF';
			}
			else if($css=='yellow')
			{
				$background = 'FFFF00';
				$font = '000000';
			}
			else if($css=='green')
			{
				$background = '008000';
				$font = 'FFFFFF';
			}
			else
			{
				$background = 'FFFFFF';
				$font = '000000';
			}
			
			$this->objPHPExcel->getActiveSheet()->getStyle($this->columnName($a).($row+2-$offset))->applyFromArray(
				array(	'font'	=> array(
									'bold'      => true,
									'color'	=> array( 'rgb' => $font )
								),
						'fill' 	=> array(
									 'type'		=> PHPExcel_Style_Fill::FILL_SOLID,
									 'color'	=> array('rgb' => $background)
								),
				));
			$this->objPHPExcel->getActiveSheet()->getStyle($this->columnName($a).($row+2-$offset))->getAlignment()
					->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER)->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
		}
		
		$this->_lastCell = $this->columnName($a).($row+2-$offset);
	}	
}

0

#59 User is offline   rikim1228 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 01-August 12

Posted 01 August 2012 - 02:30 PM

Hi, thank you for your helpful extension. I've got it working but saw the release notes and the mention of export buttons as being new to v0.3. I do not quite understand what its purpose is and how it is to be used. Could you please post an example? My initial thought, after reading the notes, was that it customizes the default CGridView with export buttons...is this correct?
0

#60 User is offline   rikim1228 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 01-August 12

Posted 01 August 2012 - 02:55 PM

View Postrikim1228, on 01 August 2012 - 02:30 PM, said:

Hi, thank you for your helpful extension. I've got it working but saw the release notes and the mention of export buttons as being new to v0.3. I do not quite understand what its purpose is and how it is to be used. Could you please post an example? My initial thought, after reading the notes, was that it customizes the default CGridView with export buttons...is this correct?


I was able to figure it out on my own but am still trying to get the actual exporting to happen now.
0

Share this topic:


  • (6 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users