N
N
Nikolai Novosad2016-07-11 23:58:09
Yii
Nikolai Novosad, 2016-07-11 23:58:09

Yii Specify header and numbering when exporting to DOC?

Hello. To export data to DOC, I do this in a similar way:

View:
echo CHtml::link('Generate Word', array('Calculator/generateWord'));

Controller:
    public function actionGenerateWord() {
    $var = "Hello World!";
    $div = $this->renderPartial('graphs/word', array('var'=>$var), true);
    header("Pragma: no-cache");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: private", false);
    header("Content-type: application/vnd.ms-word");
    header("Content-Disposition: attachment; filename=\"test.doc");
    header("Content-Transfer-Encoding: binary");
    ob_clean();
    flush();
    echo $div;
    Yii::app()->end();
}

Rendered view:
<table>
    <tr>
        <td>This is just a test</td>
    </tr>
    <tr>
        <td><?php echo $var; ?></td>
    </tr>
</table>

But I still need to make a footer and numbering.
Is it possible to organize it in the way I do, or should I look for another implementation of the export?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Novosad, 2016-07-12
@nik_neman

stackoverflow.com/questions/13340216/html-generate...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question