codeigniter-3export-to-word

All the code written in my view also appears in the doc when i export to DOC in php Codeigniter


My Controller Code :

   public function export()
   {
    header("Content-Type: application/vnd.msword");
    header("Expires: 0");
    header("Cache-Control:  must-revalidate, post-check=0, pre-check=0");
    header("Content-disposition: attachment; filename=\"Proposal TJSLP (".date('d-m-Y H:i:s').").doc\"");

    $where = array('usulan_id' => $this->uri->segment(4));
    $data['data'] = $this->data_model->export_usulan($where)->result();

    $this->load->view("usulan_export", $data);
   }

My View :

<?php foreach ($data as $key => $h) { ?>
<center>
<h1>PROPOSAL</h1>
<h3>
    ((Nama Perusahaan)) <br> TAHUN <?php echo date('Y'); ?> <br><br><br>
    <?php echo $h->nama; ?>
</h3>
</center>
<?php } ?>

The return is :

The Return

The export to DOC is works, but all the code written in my view also appears in the doc, like code a "" etc. I just called the picture is not called in the document. Please tell me, how to make the code illegible and appear according to the code we write??


Solution

  • In the view just add :

    <html>
    <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    ....