Yii Framework Forum: [ASK] cara generate ke excell - Yii Framework Forum

Jump to content

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

[ASK] cara generate ke excell Rate Topic: -----

#1 User is offline   kfahmi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 81
  • Joined: 19-March 12

Posted 06 June 2012 - 06:32 AM

Om mas tante kakak bapak,,

ada yang tau gak extension buat convert dari PHP jadi ke file EXCELL? :(
0

#2 User is offline   y_i_i 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 26-March 12

Posted 08 June 2012 - 04:35 AM

coba pake EExcelView,, saya juga lagi ngerjain export to excel tp mentokk niihh error,,
ada yang pernah pake ga sebelum nyah? saya binggung cara dptin dataProvider dari cgridview nya gimana,,
ERROR messagenya bilang dataProvider cannot be empty,,
0

#3 User is offline   saebaryo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 74
  • Joined: 13-October 10
  • Location:jogjakarta - Indonesia

Posted 08 June 2012 - 10:54 AM

http://www.yiiframew...ibrary-with-yii
everything must standing on balance
0

#4 User is offline   y_i_i 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 26-March 12

Posted 12 June 2012 - 12:28 AM

maaf yh tapi saya masii ga ngertii hehehehehh,,
itu kn data diset manual nah bisa contohin ga gmn controller biar dpt dataProvider dr gridview yang ada,, makasii hehehehh :lol:
0

#5 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 12 June 2012 - 08:28 AM

View Postsaya pemula, on 12 June 2012 - 12:28 AM, said:

maaf yh tapi saya masii ga ngertii hehehehehh,,
itu kn data diset manual nah bisa contohin ga gmn controller biar dpt dataProvider dr gridview yang ada,, makasii hehehehh :lol:


Sesuai saran agan 'saya pemula', pakai Eexcelview saja.
Dijamin pembuatan excel semudah membuat cgridview. Ini contoh membuat excelnya

public function actionJadiExcel(){
                        $dataProvider = $model->search(false);
			$this->widget('ext.EExcelView', array(
				'title'=>'Daftar User',
				'dataProvider'=>$dataProvider,
				'columns'=>array(
					'number',
					'full_name',
					'address',
					'email',
				),
			)); 
}


konfigurasikan error_reporting web servernya jadi E_ERROR, karena bisa menyebabkan kegagalan jika pakai yang lain (kalo gak salah, dah lama gak pakai soalnya :P)
“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
0

#6 User is offline   y_i_i 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 26-March 12

Posted 13 June 2012 - 12:19 AM

kalo controller untuk model saya seperti ini ::

        public function actionToCSVl()
        {
                $model=new BankPayment('search');
                                $model->unsetAttributes();  // clear any default values
                                if(isset($_GET['BankPayment']))
                                $model->attributes=$_GET['BankPayment'];
                
                                
                                //$this->actionExcel($model, $columns, 'MyTitle', array(), 'CSV');
                                $this->render('excel',array('model'=>$model));
        }

        public function behaviours()
                                {
                                        return array(
                                                'eexcelview'=>array(
                                                        'class'=>'ext.EExcelView.EExcelBehavior',
                                                ),
                                        );
                                }


sedangkan
$factory = new CWidgetFactory();    
        $widget = $factory->createWidget($this, 'ext.EExcelView', array(
            'dataProvider'=>$model->search(),
            'id'=>'grid',
            'grid_mode'=>'export',
            'title'=>'Title',
            'filename'=>'Bankreport',
            'stream'=>true,
            'exportType'=>'Excel2007',
            'columns'=>array(           'id',
                                        'name',
                                        'address',
                                        'email',
                                ),

 ));
 
        $widget->init();
        $widget->run();

diview yang bersangkutan,,
cuma skrng saya bingung dicontrollernya untuk ngambil data klo dr dataProvider,,
karena saya pake byk cgridview disatu halaman, trus saya tambahin button di tiap cgridviewnya,
echo CHtml::Button('Export', array('submit' => Yii::app()->createUrl('report/ToCSVl',array('id'=>'grid'))));



please repp, :) dan thx untuk saran dan masukkan,, :lol:
0

#7 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 13 June 2012 - 10:20 AM

Agan taruh koding render EExcelView di file views yah?

Saya belum pernah coba di file views, dan saya juga tidak pernah coba pakai WidgetFactory. Jadi saya sih pakai cara paling sederhana.

Koding saya cuman seperti di bawah itu,
$this->widget('EExcelView', array(
     'dataProvider'=> $dataprovider,
     'title'=>'Title',
     'autoWidth'=>false,
      ..... other options 
));

ditaruh di dalam controller langsung....

Dan controller tidak boleh ada jeda spasi, echo atau apapun yang bisa mengeluarkan teks ke browser. Karena kita mau generate file, jadi sama sekali tidak boleh ada output echo atau sejenisnya.

Terus masalah DataProvider saya tidak paham. Agan boleh saja donk bikin banyak-banyak dataprovider, yang penting bedain saja nama variabelnya. Setau ane harusnya solve.. tapi yah ini perkiraan ane saja... ehehe
“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
0

#8 User is offline   y_i_i 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 26-March 12

Posted 14 June 2012 - 09:50 AM

klo saya rubah cuma controllernyah ajah jd seperti yang agan tulis diatass,,
pesan error nyah

The "dataProvider" property cannot be empty.


klo liat disini pake
$factory = new CWidgetFactory();    
$widget = $factory->createWidget($this, 'EExcelView', array(


klo saya contoh sama persis

begini pesan error nyah

Fatal error: Call to a member function getData() on a non-object in C:\Program Files\xampp\htdocs\accounting\protected\extensions\EExcelView\EExcelView.php on line 137

mungkin ada masukkan gan ? maklum saya baru niihh hehehehehh :rolleyes:
0

#9 User is offline   ahmadroni 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 250
  • Joined: 14-June 09
  • Location:Yogyakarta-Indonesia

Posted 15 June 2012 - 08:55 PM

mungkin perlu lihat contoh dari agan Junxiong, kayaknya yang ente tulis beda dengan contohnya gan..!
Hospital Cost Management System and
Hospital Management Information System
0

#10 User is offline   y_i_i 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 26-March 12

Posted 18 June 2012 - 11:26 PM

sudahh bisa mastaa dan suhuu sekaliiiaaannn atas bantuan dan sarannya,,
kaliiaaannn baikk sekaliiii :-* :lol:
0

#11 User is offline   J.J 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 126
  • Joined: 01-April 11

Posted 22 June 2012 - 01:28 PM

View Postjunxiong, on 12 June 2012 - 08:28 AM, said:

Sesuai saran agan 'saya pemula', pakai Eexcelview saja.
Dijamin pembuatan excel semudah membuat cgridview. Ini contoh membuat excelnya

public function actionJadiExcel(){
                        $dataProvider = $model->search(false);
			$this->widget('ext.EExcelView', array(
				'title'=>'Daftar User',
				'dataProvider'=>$dataProvider,
				'columns'=>array(
					'number',
					'full_name',
					'address',
					'email',
				),
			)); 
}


konfigurasikan error_reporting web servernya jadi E_ERROR, karena bisa menyebabkan kegagalan jika pakai yang lain (kalo gak salah, dah lama gak pakai soalnya :P)


Sekedar untuk melengkapi saja yg ditulis agan Junxiong, utk lebih amannya dapat ditulis spt ini (perbedaan pada grid_view)
public function actionJadiExcel(){
                        $dataProvider = $model->search(false);
			$this->widget('ext.EExcelView', array(
				'title'=>'Daftar User',
                                
                                'grid_view' => 'export', // default bernilai 'grid'

				'dataProvider'=>$dataProvider,
				'columns'=>array(
					'number',
					'full_name',
					'address',
					'email',
				),
			)); 

0

#12 User is offline   y_i_i 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 38
  • Joined: 26-March 12

Posted 25 June 2012 - 03:59 AM

mastaaa saya mw buat pdf juga niihh,,

controller ane,,

	public function actionPDF($id)
	{
	Yii::import('application.extensions.phpexcel.JPhpExcel');
	$this->renderPartial('pdf',array('model'=>$this->loadmodel($id)),false,true);
	}
	


ini pdf.php cuma ditambahin ini
                 header('Content-Type: application/pdf');
		 header('Content-Disposition: attachment;filename="surat.pdf"');




nah begini error nyah saya attach,,
mohon pencerahann para mastaaa,, mungkin ada yang kurang atau salah mohon masukan, saran dan bantuannn nyahhh,, ;D

Attached File(s)


0

#13 User is offline   had 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 03-July 12
  • Location:Bandung

Posted 30 April 2013 - 10:33 PM

Siang agan2 sekalisn,

Terima kasih sebelumnya dari ilmu di atas

Saya newbie juga n sempet baca dari atas ternyata Eexcel view yg dsimpen di controller nya nya keren bner
udah bisa langsung keluar excel kaya grid view

tapi saya ada permasalahan ketika pake advance search (dari search form ) di CGridview nya sudah sesuai dengan yg diminta, tapi ketika di convert ke excel hasil nya malah kaya ilang filternya gan

Mohon bantuan agan2 sekalian yah gan :blink: pusiiing gan
0

Share this topic:


Page 1 of 1
  • 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