[eluser]dalirnet[/eluser]
php excel class is very good
but create your personal library in CI
this is part of my personal library:
Code:
class Excel_lib
{
public $excel;
public $CI;
public function __construct()
{
// require phpexcel
require_once APPPATH.'libraries/PHPExcel/PHPExcel.php';
$this->CI = & get_instance();
}
public function load($path)
{
$objReader = PHPExcel_IOFactory::createReader('Excel5');
$this->excel = $objReader->load($path);
}
public function save($path,$mime_type)
{
// xls or xlsx
if($mime_type == 2003)
{
$excel_out = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5');
$excel_out->save($path);
}
else
{
require_once APPPATH.'libraries/PHPExcel/PHPExcel/Writer/Excel2007.php';
$excel_out = new PHPExcel_Writer_Excel2007($this->excel);
$excel_out->save($path);
}
}
public function protection()
{
...
}
public function create($data)
{
$this->excel = new PHPExcel();
//
$sheet_properties->setCreator('The ParsaMehr Education App');
$sheet_properties->setTitle($data['work_title']);
$sheet_properties->setSubject('The ParsaMehr Education App');
if(array_key_exists('protect', $data) and $data['protect'] == true)
{
$this->protection();
}
...
pm for full library