使用codeigniter导出MS Word文档?

问题描述

| 使用codeigniter导出MS word文档有关如何编码的任何想法或教程?谢谢     

解决方法

        尝试这个:
header(\"Content-Type: application/vnd.ms-word\");
header(\"Expires: 0\");
header(\"Cache-Control:  must-revalidate,post-check=0,pre-check=0\");
header(\"Content-disposition: attachment; filename=\\\"mydocument_name.doc\\\"\");

$output = $this->load->view(\"myreport\",$mydata);
echo $data;
exit;
    ,        您可以尝试使用Excel和Word导出数据 首先你做控制器 这样的
<?php if(!defined(\'BASEPATH\')) exit(\'No direct script access allowed\');
class Data extends CI_Controller
{
  public function index()
  {
     $this->load->view(\'data_page_view\'); 
  }
  public function toExcel()
  {
     $this->load->view(\'spreadsheet_view\');
  }
}
在这样的视图中放置您要下载的链接
<a href=\'data/toExcel\'>Export Data</a>
这可能是您对Excel数据的看法
    <?php         
    header(\"Content-type: application/octet-stream\");
    header(\"Content-Disposition: attachment; filename=exceldata.xls\");
    header(\"Pragma: no-cache\");
    header(\"Expires: 0\");
    ?>
    <table border=\'1\'>
      <tr>
        <td>ID</td>
        <td>First Name</td>
        <td>Last Name</td>
        <td>Important info</td>
      </tr>
      <tr>
        <td>Nadeem</td>
        <td>Ijaz</td>
        <td>Nothing really...</td>
      </tr>
    </table>
这个代码用于单词数据
    <?php         
    header(\"Content-Type: application/vnd.ms-word\");
    header(\"Expires: 0\");
    header(\"Cache-Control:  must-revalidate,pre-check=0\");
    header(\"Content-disposition: attachment; filename=\\\"worddata.doc\\\"\");
    ?>
    <table border=\'1\'>
      <tr>
        <td>ID</td>
        <td>First Name</td>
        <td>Last Name</td>
        <td>Important info</td>
      </tr>
      <tr>
        <td>Nadeem</td>
        <td>Ijaz</td>
        <td>Nothing really...</td>
      </tr>
    </table> 
    

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...