Yii 1.1: exportasxls

A light weight PHP class allow to the creation of simple xls spreadsheets from array data.
6 followers

A light weight Yii Extension allow to the creation of simple xls spreadsheets from array data.

Requirements

Yii 1.1 or above

PHP 5 above

Usage ΒΆ

Unzip the file ExportXLS.tar.gz into protected/extensions/

Then try as below,

// Importing ExportXLS class file
 
Yii::Import('application.extensions.ExportXLS.ExportXLS');
 
// Xls Header Row
$headercolums =array('Name','age'); 
 
// Xls Data
$row=array(array('Sachin','35'),array('sehwag',30));
 
// Xls File Name
$filename = 'fileName.xls';
    $xls      = new ExportXLS($filename);
    $header = null;
    $xls->addHeader($headercolums);
    $xls->addRow($row);
    $xls->sendFile();

Happy Coding Yes It Is ........

Total 4 comments

#17900 report it
Rohit Suthar at 2014/08/08 08:45am
Nice

Simple but nice :)..

#17877 report it
Nisanth thulasi at 2014/08/05 01:21am
In action

Hi vijay p s ,

We can use it in action . so this code snippets use in controllers and models, for betting coding standard model is right. (Thin controller and fatty models)

#17876 report it
vijay p s at 2014/08/05 12:42am
Doubt!

Can u please Tell me On which page we use this code in our file.? i am a newbie for this yii.. help me out..

#17871 report it
Thommee at 2014/08/03 01:44pm
It working as well

It is a great base for extendig exisiting xls-based libraries.

In my case, I had to change converter "utf8 => iso-8859-1" to "utf8 => iso-8859-2". After this change, it works perfectly.

Thanks!

Leave a comment

Please to leave your comment.

Create extension