Welcome Guest, Not a member yet? Register   Sign In
Save Page as PDF/Excel File Button
#1

[eluser]Unknown[/eluser]
Best way to go about saving a page (data from the database) as a PDF/Excel file?

I want a nice, pretty button that has Save as PDF or Save as XLS/CSV (I haven't decided yet), but I thought about using a nice plugin for the PDF - any recommendations?

Thanks!
#2

[eluser]robert.fulcher[/eluser]
You can try this.

https://phpexcel.codeplex.com
#3

[eluser]Unknown[/eluser]
Thank you! Will give it a go Smile
#4

[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




Theme © iAndrew 2016 - Forum software by © MyBB