Cgridview To Excel

Good day guys I already using an extension that can export CGridView table to excel but there is one thing missing which is the Title Row. thanks and God bless. Please give suggestion :)

Example

excel sheet




|              TITLE               |

|HEADER|HEADER|HEADER|HEADER|HEADER|

| DATA | DATA | DATA | DATA | DATA |

| DATA | DATA | DATA | DATA | DATA |

| DATA | DATA | DATA | DATA | DATA |

| DATA | DATA | DATA | DATA | DATA |



Which Extension are you using currently??

eexcelview.EExcelBehavior

tlbExcelView

This Post will definately help you. It has lot of other features including the title you need.

Hi

How to export the CGridView to excel using EExcelView?

Please help me to export to excel the data which is displayed in the webpage?

hi

you are use this code:





   public function actionExl() {




        $model = LtLetter::model()->findAll();

        

        header("Content-Type: application/vnd.ms-excel");

        header("Expires: 0");

        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

        header("content-disposition: attachment;filename=report.xls");


        echo '<html><meta content="text/html; charset=utf-8" http-equiv="Content-Type"><body><table >';


        echo '<tr>';

        echo '<th>id</th>';

        echo '<th>title</th>';

        echo '<th>date</th>';

        




        echo '</tr>';

        $i = 1;

        foreach ($model as $value) {


            echo '<tr>';

            echo '<td>' . $i++ . '</td>';


            echo '<td>' . $value->title . '</td>';

            echo '<td>' . $value->dt . '</td>';

           


            echo '</tr>';

        }

        echo '</table></body></html>';

    }