Hi, right now i am try to use 3rd party library for extracting my data to excel using lib PHPExcel (http://www.phpexcel.net/).
The problem is the name of class is different with its file name.
For example class "PHPExcel_Writer_Excel5" is in file name "Excel5.php".
When i try to instance it (new PHPExcel_Writer_Excel5) yii return error "file not found". If i change my instance to its file name (new Excel5), yii not return any error but the lib wont work.
Any solution ?? Of course Except changing all class PHPExcel_Writer_Excel5 in file Excel5.php, to class Excel5
Thank you
Page 1 of 1
How to instance a class that have different name with it's file name??
#2
Posted 21 December 2009 - 02:56 AM
munemune, on 21 December 2009 - 12:28 AM, said:
Hi, right now i am try to use 3rd party library for extracting my data to excel using lib PHPExcel (http://www.phpexcel.net/).
The problem is the name of class is different with its file name.
For example class "PHPExcel_Writer_Excel5" is in file name "Excel5.php".
When i try to instance it (new PHPExcel_Writer_Excel5) yii return error "file not found". If i change my instance to its file name (new Excel5), yii not return any error but the lib wont work.
Any solution ?? Of course Except changing all class PHPExcel_Writer_Excel5 in file Excel5.php, to class Excel5
Thank you
The problem is the name of class is different with its file name.
For example class "PHPExcel_Writer_Excel5" is in file name "Excel5.php".
When i try to instance it (new PHPExcel_Writer_Excel5) yii return error "file not found". If i change my instance to its file name (new Excel5), yii not return any error but the lib wont work.
Any solution ?? Of course Except changing all class PHPExcel_Writer_Excel5 in file Excel5.php, to class Excel5
Thank you
Create a new dummy class inside of the Excel class maybe?
class Excel5 extends PHPExcel_Writer_Excel5 {}
#4
Posted 21 December 2009 - 11:28 AM
@Y!! : Its still give me error (a blank page to be exactly)
@Sander : Yes that what i thought at first (before i post this), but renaming all file and class would be tedious work. PHPExcel have many file and each other connected, more worst every file and every class have different name only main class that have same name with file name.
Anyway rightnow i got much simpler solution for extracting data to excel (not "feature full" but its works). Editing/using the view script.
Thanks
@Sander : Yes that what i thought at first (before i post this), but renaming all file and class would be tedious work. PHPExcel have many file and each other connected, more worst every file and every class have different name only main class that have same name with file name.
Anyway rightnow i got much simpler solution for extracting data to excel (not "feature full" but its works). Editing/using the view script.
Thanks
Share this topic:
Page 1 of 1

Help














