Yii Framework Forum: [SOLVED] PHPExcel , menampilkan header CGridView - Yii Framework Forum

Jump to content

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

[SOLVED] PHPExcel , menampilkan header CGridView Rate Topic: -----

#1 User is offline   mhdrasad 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 199
  • Joined: 20-April 11
  • Location:Bumi Indonesia

Posted 29 September 2011 - 01:15 AM

Master2&Agan2, ane mau nanya. Gimana caranya menampilkan header pada CGridView yang di export ke file excel menggunakan PHPExcel. UntuK proses exportnya sudah berhasil, tapi headernya tidak muncul. Pengennya Header di excel (hasil export) sama seperti title atribut pada data yang ada di CgridView.

Ini CgridViewnya, sudah saya coba tapi tidak berhasil (export berhasil tapi header tidak muncuk)
<?php $this->widget('zii.widgets.grid.CGridView', array(
        'id'=>'skdata-grid',
        'dataProvider'=>$model->search(),
        'filter'=>$model,
        //'selectableRows' => 2,
        'columns'=>array('title', // << PAKE INI JUGA TETEP GAK MUNCUL HEADERNYA
                   array(
                  'class'=>'CCheckBoxColumn', 
                  'cssClassExpression' => '\'myCheckBox\'',  'value'=>'$this->grid->dataProvider->pagination->currentPage*$this->grid->dataProvider->pagination->pageSize+$row+1',	
                         ),
		'nik',
                ...
                ...
                ...
?>


Mohon bimbingannya para master sekalian.
Wait For True Concept or Finish it With Coding Concept .
#chadnox
0

#2 User is offline   mhdrasad 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 199
  • Joined: 20-April 11
  • Location:Bumi Indonesia

Posted 30 September 2011 - 02:12 AM

alhamdulillah sudah bisa,
caranya ditambahin manual aja.

//ditulis sebelum isi table.
$xls->addArray($headerBuatan);
$xls->addArray($isitable);
$xls->generateXML('excel');

Wait For True Concept or Finish it With Coding Concept .
#chadnox
0

#3 User is offline   aqge 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 188
  • Joined: 02-September 10
  • Location:Indonesia

Posted 03 October 2011 - 10:17 PM

View Postputrilangit, on 30 September 2011 - 02:12 AM, said:

alhamdulillah sudah bisa,
caranya ditambahin manual aja.

//ditulis sebelum isi table.
$xls->addArray($headerBuatan);
$xls->addArray($isitable);
$xls->generateXML('excel');



sepertpi nulis biasa ya gan....
ane punya saran kan kalo sudah bisa , bgmn kalo header yang agan buat, langusn gbisa mengkonversi array =>array menjadi merge colom.. cuma saran lho gan
Best Regard
Tidak ada coding yang salah
Yang ada hanyalah Coding yang lebih baik
0

#4 User is offline   mhdrasad 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 199
  • Joined: 20-April 11
  • Location:Bumi Indonesia

Posted 03 October 2011 - 10:28 PM

View Postaqge, on 03 October 2011 - 10:17 PM, said:

sepertpi nulis biasa ya gan....
ane punya saran kan kalo sudah bisa , bgmn kalo header yang agan buat, langusn gbisa mengkonversi array =>array menjadi merge colom.. cuma saran lho gan


iya gan nulis biasa, Tapi...wow itu yang ane cari gan. merge column nya gimana gan?. Bisa diatur gak lebar columnya?. Soalnya klo ikutin defaultnya setelah generate, si column-nya juga ukuran default. Jadi klo mau baca jelas isi coloum yang lumayan panjang mesti digeser lagi. Itu gimana caranya atur lebar column-nya gan?. Manteb bener nih gan aqge, mohon bimbingannya gan. :D
Wait For True Concept or Finish it With Coding Concept .
#chadnox
0

#5 User is offline   han2 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 45
  • Joined: 12-November 12

Posted 10 December 2013 - 05:17 PM

View Postmhdrasad, on 30 September 2011 - 02:12 AM, said:

alhamdulillah sudah bisa,
caranya ditambahin manual aja.

//ditulis sebelum isi table.
$xls->addArray($headerBuatan);
$xls->addArray($isitable);
$xls->generateXML('excel');



tanya gan..itu codingannya ditulis dimana ya gan? :unsure:
0

#6 User is offline   mhdrasad 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 199
  • Joined: 20-April 11
  • Location:Bumi Indonesia

Posted 11 December 2013 - 01:13 AM

View Posthan2, on 10 December 2013 - 05:17 PM, said:

tanya gan..itu codingannya ditulis dimana ya gan? :unsure:


klo gak salah di controller gan. lupa2 inget... project lama soalnya :D
Wait For True Concept or Finish it With Coding Concept .
#chadnox
0

#7 User is offline   han2 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 45
  • Joined: 12-November 12

Posted 15 December 2013 - 08:37 PM

View Postmhdrasad, on 11 December 2013 - 01:13 AM, said:

klo gak salah di controller gan. lupa2 inget... project lama soalnya :D


ditaroh di controller tapi katanya undefined var xls gan.maap gan super newbie :blink:
0

#8 User is offline   mhdrasad 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 199
  • Joined: 20-April 11
  • Location:Bumi Indonesia

Posted 18 December 2013 - 01:37 AM

View Posthan2, on 15 December 2013 - 08:37 PM, said:

ditaroh di controller tapi katanya undefined var xls gan.maap gan super newbie :blink:


mungkin belum di panggil gan

Yii::import('application.extensions.phpexcel.JPhpExcel');
$xls = new JPhpExcel('UTF-8', false, 'My Test Sheet'); // mungkin baris ini belum agan definisikan
$xls->addArray($data);
$xls->generateXML('my-test');


lengkapnya disini
Wait For True Concept or Finish it With Coding Concept .
#chadnox
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