Yii Framework Forum: generate excel - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

generate excel Rate Topic: -----

#1 User is offline   mithila 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 116
  • Joined: 18-April 11

Posted 09 May 2011 - 01:18 AM

hi all,


Can anybody tell me how to generate an excel onclick of a button. I have gone through the documentation phpexcel but i dont know how to implement it. Can anybody show me an example.


Thankyou
0

#2 User is offline   mithila 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 116
  • Joined: 18-April 11

Posted 09 May 2011 - 01:51 AM

This is solved. I figured out how to use it.
Just had to insert this code in the controller
public function actionGenerate()
	{
		$model=new Purchases;
$data = array(
    1 => array ('Name', 'Surname'),
    array('Schwarz', 'Oliver'),
    array('Test', 'Peter')
);
Yii::import('application.extensions.phpexcel.JPhpExcel');
$xls = new JPhpExcel('UTF-8', false, 'My Test Sheet');
$xls->addArray($data);
$xls->generateXML('my-test');
		$this->render('create',array(
			'model'=>$model,
		));
	}

0

#3 User is offline   qwerty 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 290
  • Joined: 20-November 08

Posted 09 May 2011 - 01:56 AM

Or you can create widget :)
0

#4 User is offline   mithila 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 116
  • Joined: 18-April 11

Posted 09 May 2011 - 02:02 AM

View Postqwerty, on 09 May 2011 - 01:56 AM, said:

Or you can create widget :)



HI qwerty,

The excel file that i generated is corrupt. Can u tell me how to fix this?

Thanks

Mithila
0

#5 User is offline   Karthik12 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 15-March 11

Posted 23 June 2011 - 08:11 AM

View Postqwerty, on 09 May 2011 - 01:56 AM, said:

Or you can create widget :)

how and where we do create widget
0

#6 User is offline   itpg 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 01-April 11

Posted 30 October 2011 - 01:35 AM

View Postmithila, on 09 May 2011 - 02:02 AM, said:

HI qwerty,

The excel file that i generated is corrupt. Can u tell me how to fix this?

Thanks

Mithila

maybe this discussion will help - http://phpexcel.code...cussions/211116
0

#7 User is offline   mbaksri 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 69
  • Joined: 15-July 11

Posted 21 March 2012 - 03:47 AM

Hi mithila, i'm interested with yr topic cause i faced the same thing..
this' my problem. I'd like to export my table (gotten from sql) into excel format. but i really have a doubt with it.. Do you have any suggestion for me? A lot of thanks :D
0

#8 User is offline   sirin k 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 15-March 12
  • Location:India

Posted 19 June 2012 - 04:21 AM

you can try the code generated by my extension giiplus CRUD generator:
http://www.yiiframew...ension/giiplus/
Sirin k
Yii developer
http://sirink.tumblr.com
0

#9 User is offline   masapri 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 21-July 12

Posted 21 July 2012 - 01:23 AM

View Postsirin k, on 19 June 2012 - 04:21 AM, said:

you can try the code generated by my extension giiplus CRUD generator:
http://www.yiiframew...ension/giiplus/


Hi Sirin,
I want to use your extension, but the additional 3 features are never generated.
I've copied the giiplus.zip into extension directory & I use Yii bootstrap.

Here's my gii Module config:

'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'xxxxx',
'ipFilters'=>array('127.0.0.1','::1'),
'generatorPaths'=>array('bootstrap.gii','ext.giiplus'),

),


and the following is my component's config:

'components'=>array(
.....
'bootstrap'=>array(
'class'=>'ext.bootstrap.components.Bootstrap',
),
),


What is missing from my system configuration?

Thank you Sirin!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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