Yii 1.1: yiireport

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


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


Total 9 comments

#15634 report it
C.S.Putera at 2013/12/02 06:01am
Failed To Load PDF

Found the solution. I set the max memory limit and execution time before rendering the pdf.

ini_set('memory_limit', '-1');
#15633 report it
C.S.Putera at 2013/12/02 04:58am
Failed To Load PDF

Hello. I have used this extension for a while and this is awesome. But I'm having some difficulties. I have created a template (.xlsx), consisting of 130 rows. I haven't tried to pass the data, just wanna see the outcome of the template. But when I try to load it, it said "Faild to Load PDF" ( using Chrome ). I can't load it using firefox neither. But, if I delete row no 1 - 35 or 36 - 50, then it runs well. Is there any limitations of how many rows can be rendered ? Please help, thank you.

#15032 report it
Kiin Balam at 2013/09/30 11:17am
Test and PDF

@Johanovski Sorry, I try your code with test arrays and works for me. :/

@fouss the PDF render work it's made by external libs, TCPDF or mPDF. The processed template is exported to html and that html is taken by the PDF lib, then the lib do the job.

#15028 report it
fouss at 2013/09/30 06:10am
rendering pdf file

Why not give a clear instructions bout rendering pdf ?

#14955 report it
Johanovski at 2013/09/24 06:26am
YiiReport suddenly stopped working

Hi there! First of all, congratulations for the work you've done: it's awesome! I'm having a problem generating Excels: I've been able to do it during months without any problem, but now it has stopped working. In my localhost installation it works fine, but in the online version, when I try to generate an Excel, it shows a kind of "page not found" error... However, if I comment the "render" function call, it doesn't show this error (of course it doesn't either generate the file). It's weird because I haven't changed anything, so I don't know what can be happening... Any idea? The code I'm using is quite simple:

$data[] = array('dni'=>$dninie,
$r = new YiiReport(array('template'=> $template));
            'id' => 'ong',
            'data' => array(
                'name' => $nom
echo $r->render('excel2007', $filename);

Thanks in advance!

#14538 report it
Kiin Balam at 2013/08/21 01:29pm
RE PDF Report

You must use a pdf library, like mPDF, download and paste on «vendors» directory.

On yiireport.php you must set a config for the PDF library to use:

return array(
    'pdfRenderer' => 'mpdf',//or 'dompdf', 'tcpdf'
    'pdfRendererPath' => 'application.vendors.mpdf',
    'templatePath' => 'application.views.reports'

Then you can:

echo $r->render('pdf', 'name');
#14527 report it
had at 2013/08/20 10:00pm
PDF Report

Its nice extention but i had trouble creating pdf report, Excel report works like charm, but how to create pdf report anyone can help please ?

#14252 report it
cioxideru at 2013/07/30 05:10am
sheets support

please add ability to generate reports with multi sheets

#13477 report it
bmac at 2013/05/30 05:05pm
Grid Lines

Love the extension. Is there anyway to keep the grid lines from showing when printing to PDF?

EDIT: I figured it out. I unchecked gridlines from the view panel.

Leave a comment

Please to leave your comment.

Create extension