Yii extension for export Spreadsheet and PDF from scratch or templates using PHPExcel and PHPReport Libraries.

This library needs YiiExcel extension for work.


  • Yii 1.1 or above.
  • PHPExcel 1.7.8
  • YiiExcel extension.
  • Optional: TcPDF, DomPDF or mPDF library.


  1. Download and install YiiExcel extension.
  2. Download a PDF library, like mPDF and copy to protected/vendors directory
  3. Download and Unzip YiiReport, then copy yiireport directory to protected/extensions.
  4. Edit yiireport.php config file if you need. Here you set the PDF library to use, the path for that library and the template path.
  5. Add YiiReport to imports:


$r = new YiiReport(array('template'=> someTemplate.xls));
echo $r->render(format, name);


  • Inside yiireport.php config file, you must use alias path format.
  • The output format options are: 'excel5' for xls, 'excel2007' for xlsx, 'html' and 'pdf'.
  • PHPReport class have lites modifications over the original PHPReport class by Vernes Å iljegović.


  1. Copy students.xls file from examples/templates to views/reports
  2. Copy actionExcel() method from SiteController.php example file to your own SiteController